WordPress Gallery Shortcode Customization

We can customize WordPress gallery short code easily. It is on pluagable file so, this function can be override by theme functions.php or through plugins. Say How to customize the output of the WP image gallery shortcode from a plugin?

Just need to call this hook in your theme or plugins and write this function according to latest wordpress.

You can find the hook i’m using in wp-includes/media.php inside the gallery shortcode callback function(see line 763).

http://core.trac.wordpress.org/browser/tags/3.0.1/wp-includes/media.php#L745

In from end gallery out put comes using this functions. So you can set default number of image per rows.

By using this you can set default image link. Say below list of items sometimes we need to customize.

  • wordpress gallery settings default link to media file not attachment
  • gallery media file link not working as default
  • Gallery Links to Attachement Page instead of Media file
  • Make Image Attachments Default Link To Original Image
  • Gallery: Link to Media File selected, but link=”file” missing from shortcode
  • Change Gallery Settings “Link to” Default file not post attachment

All possible solutions can be solved here here

The above long code, you should find the below link

Just make last true to false. Than output result will be same as link=”file”. For example

Hope this will help someone.