How to customise the output of the WP image gallery short code from a plugin?

Posted by Prem Tiwari | Updated on

There’s two ways you can go about this, but both involve creating a function that does pretty much the same as the existing gallery shortcode function…

You can either..

  1. Hook onto post_gallery and manipulate the incoming data(you can use the gallery shortcode function as a base for the filter if necessary)
  2. Unregister the gallery shortcode and register a new gallery shortcode with modifications(again you can use the existing function as a base if necessary)

I did something similar in this thread, and i’m only referring to it because i’m going to take the same approach for the example that follows.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers