How To Fix Wordpress Gallery Issues Without A Plugin


One of my friend told me that he is fed up with adding one post another as he couldn’t find a way to add images one after another (full size) without linking to original images especially when he adds a gallery. By default if you insert a gallery in WordPress post, the images are linked to itself. If you are showing thumbnails of large images on your post page then linking to original size image is a great option but what about showing full size there and then. In that case you don’t want to add a link to image you have to install a plugin to do so. Installing plugins for simple tasks is not what i have in mind. Here is how i fixed few issues pertaining to WordPress gallery shortcodes.

How To Insert Full size Images In WordPress Gallery

Inserting a full size image as gallery in your post is easy you have to do the followings:

  1. Upload Images In Gallery
  2. Insert Gallery In your post
  3. Go to HTML Menu to edit gallery shortcode
  4. Your Inserted Gallery shortcode will look something like this {gallery}
  5. Edit the gallery shortcode, something like this {gallery size="full" columns="1"}

The above modified gallery shortcode will insert images in your post one after another. But the inserted images will be linked to themselves.

Remove Image Link From WordPress Gallery Shortcode

Removing image link from WordPress gallery shortcode is easy, just write this filter in your theme’s functions.php file

Removing Embedded CSS Form WordPress Gallery Shortcode

When you attach a gallery to your post, wordpress automatically embed a CSS within your post. If you are using a customized wordpress theme then this embedded CSS will cause problems. The following code got rid of embedded CSS from wordpress posts

All i have to do now is to create the following CSS classes in styles.php

.gallery {}
.gallery-item {}
.gallery-icon {}
.gallery-caption {}

How To Call Gallery in Post Template

If for some specific reasons you want to call gallery in your post template via code you can do so by calling the following:

I hope the above wordpress gallery hacks will solve your specific gallery related issues. Please leave me a comment and let me know if you face any issues implementing the above in your wordpress theme. Subscribe our RSS to receive latest wordpress updates.

0 I like it
0 I don't like it