Title: do_shortcode
Last modified: August 22, 2016

---

# do_shortcode

 *  [goncalvesjpedro](https://wordpress.org/support/users/goncalvesjpedro/)
 * (@goncalvesjpedro)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/do_shortcode-5/)
 * When I use the do_shortcode to echo an gallery shortcode the images don’t open
   with blueimp lightbox.
 * [https://wordpress.org/plugins/blueimp-lightbox/](https://wordpress.org/plugins/blueimp-lightbox/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [blueimp](https://wordpress.org/support/users/blueimp/)
 * (@blueimp)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/do_shortcode-5/#post-5248002)
 * The lightbox plugin adds content filters for `the_content`, `the_excerpt` and`
   post_gallery`:
    [https://plugins.trac.wordpress.org/browser/blueimp-lightbox/trunk/lib/class-blueimp-lightbox.php#L60](https://plugins.trac.wordpress.org/browser/blueimp-lightbox/trunk/lib/class-blueimp-lightbox.php#L60)
 * The content filter for `post_gallery` is supposed to filter the Gallery shortcode
   output, so I’m not sure what is preventing the filter in your case:
    [http://codex.wordpress.org/Plugin_API/Filter_Reference/post_gallery](http://codex.wordpress.org/Plugin_API/Filter_Reference/post_gallery)
 *  Plugin Author [blueimp](https://wordpress.org/support/users/blueimp/)
 * (@blueimp)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/do_shortcode-5/#post-5248137)
 * I’m not sure if this is the issue, but you might need to add `link="file"` to
   the Gallery shortcode.
 *  [David](https://wordpress.org/support/users/dcrabill/)
 * (@dcrabill)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/do_shortcode-5/#post-5248214)
 * Actually, the `post_gallery` filter is intended for plugin authors who want to
   completely replace the gallery shortcode functionality. If you [look at the code](https://core.trac.wordpress.org/browser/tags/4.0/src/wp-includes/media.php#L920),
   you can see that the filter is at the beginning of the function, and that you’re
   actually filtering an empty string.
 * I definitely think there should be a filter at the end of the shortcode to amend
   a WP gallery, and I’m a bit surprised one doesn’t exist already. I went ahead
   and submitted [this ticket](https://core.trac.wordpress.org/ticket/29832) to 
   try to get it added to core.
 * Until that ticket takes effect (if it ever does), I don’t think there’s a way
   to add your awesome lightbox to a standard WP gallery if it’s added outside the
   main post content area (aside from copying the entirety of the `gallery_shortcode`
   function), unless you can get it to work without having to rely on inline attributes
   on those image elements.
 *  [David](https://wordpress.org/support/users/dcrabill/)
 * (@dcrabill)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/do_shortcode-5/#post-5248215)
 * I was wrong. As Sergey points out in the Trac ticket, there are a couple different
   ways to get the lightbox working without changes to core. Not necessarily elegant,
   but it can be done.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘do_shortcode’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/blueimp-lightbox.svg)
 * [blueimp lightbox](https://wordpress.org/plugins/blueimp-lightbox/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/blueimp-lightbox/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/blueimp-lightbox/)
 * [Active Topics](https://wordpress.org/support/plugin/blueimp-lightbox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/blueimp-lightbox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/blueimp-lightbox/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [David](https://wordpress.org/support/users/dcrabill/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/do_shortcode-5/#post-5248215)
 * Status: not resolved