zr668
Forum Replies Created
-
Update:
I’ve had a little to and fro with Jetpack support, and they’ve logged this as a feature request for a future release — https://github.com/Automattic/jetpack/issues/2134The request specifically notes this might be resolved by adding a filter on L4 of
modules/tiled-gallery/tiled-gallery/templates/partials/item.phpI dug a little deeper after they pointed me to the file above, and eventually came up with the hack below. It really is a hack, since I’ve only learned the minimum required about WordPress to get my result…
In the file
/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php, after line 120, I added the following:if (isset($atts['group'])) { $jqlbgrp = $atts['group']; $gallery_html = preg_replace("/<a href=(\".*?)>/i","<a href=$1 rel=lightbox[$jqlbgrp]>",$gallery_html); _log(get_defined_vars()); }… effectively moving the link expansion defined in
jqlb_autoexpand_rel_wlightbox()into the JP tiled gallery module. This is the only place I was able to find$atts['group']still defined while the<a>link was being constructed, so I shoehorned it in.Not very pretty, I know, but the functionality I’m after is there now.
Thanks again for your help and for the plugin!
No worries Ulf, thanks.
I’ve logged this through jetpack support — will update you if I get a response, but there’s been nothing as yet.
Best of luck with the studies!
Hi Ulf, thanks for the quick reply.
Jetpack 3.5.2 was released overnight. I’ve updated, but no change in behaviour. 🙁
As suggested, I’ve played with filter priority, focusing on the tiled gallery component. In plugins/jetpack/modules/tiled-gallery.php, line 149, I find this:
add_filter( 'post_gallery', array( $gallery, 'gallery_shortcode' ), 1001, 2 );Lowering the priority to 9 or less changes the behaviour (jqlb is set to 10). Lightbox grouped galleries work again, but the static tiled/mosaic gallery is now broken (just as if I disabled it in Jetpack settings).
So now I’m into the proverbial rabbit hole and getting deeper! Please note, I’m ok with PHP, but have zero experience in WP development.
In the HTML for the broken page/gallery, I can see that all the
<a>links to gallery images have been written with a “rel=lightbox[843]” parameter, presumably by the jetpack plugin, since it is in a<div>-based mosaic layout. The jqlb group name isn’t being passed into the address link, jetpack is just using my post’s ID throughout. Manually altering the rel parameter to the right group name and saving as static HTML restores correct behaviour.I would have thought that the priority of 10 for jqlb gave it the opportunity to set that parameter before passing over to the jetpack plugin (set at 1001). As mentioned above, I’m not familiar with WP to this level of detail, so I’m not sure where to look next (short of abandoning one or other of these plugins). I’m more than happy to change a some PHP or alter parameters, but it’s a very steep learning curve from where I am right now!
I just don’t know where to begin untangling the interations between the WP engine and the layers of plugins…
Any further thoughts or tips?
Again, thanks!
zr668