How to get it working on pages using custom queries
-
This is a great plugin.
My problem is that the plugin tries to be efficient and only load the JavaScript on pages where it is relevant. It does this by running a number of has_block() checks. But this only works on the global $post object.
So if you have page rendered using a page template that runs custom queries then the check may result in the JavaScript not being loaded where in fact it is needed as the image blocks are displayed as a result of a custom query.
A workaround is to disable the checks (line 20 of gallery-block-lightbox.php) to force the JavaScript to load on all pages. But of course this won’t survive the next update to the plugin. I wonder if there is a better solution?
The topic ‘How to get it working on pages using custom queries’ is closed to new replies.