Conversation
supportWhen I use the do_shortcode to echo an gallery shortcode the images don’t open with blueimp lightbox. https://wordpress.org/plugins/blueimp-lightbox/
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 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
I’m not sure if this is the issue, but you might need to add link="file" to the Gallery shortcode.
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 , 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 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.
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.
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 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
I’m not sure if this is the issue, but you might need to add link="file" to the Gallery shortcode.
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 , 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 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.
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.