Tagged: single media light in box
Hi,
I am trying to popup the lightbox dialog on my custom directory search page for a single media item.
I will try and explain what I have at the moment and hopefully you can tell me what I need to add and what I am missing.
I have a directory page on my site and I have overridden some php files using the duplicate folder structure in my child theme i.e mediapress/default/buddypress/directory – I have changed index.php in this folder to call a bespoke loop if the user enters a search criteria > loop-resources.php instead of loop-gallery.php.
Within my custom loop-resources.php I show all photos using the search criteria via the shortcode:<?php echo do_shortcode(‘[mpp-list-media search_terms=”‘. $search_terms .'” column=6 per_page=30 type=”‘. $type .'”]’); ?>
I then have the grid-photo.php in my child theme mediapress/default/shortcodes to try and override the shortcode behaviour to try and popup the lightbox with comments etc for the individual photo clicked on. How do I do this? Default behaviour seems to open random images, and only 6 of them, as my photos can belong to multiple galleries. Sometimes I also get a javascript console error “n is not defined”?
I have looked at the Magnific documentation and can get the light box to just open the image by setting an extra class on the a tag and a javascript call to identify that class but it does not include the comments part. If you could send me some code examples or any help of how to change the grid-photo.php to achieve this functionality it would be much appreciated.
If the way I am doing this is wrong then I am open to any other suggestions i.e calling my own query instead of the shortcode??Cheers
NashHi Nash,
There are multiple ways to do it.1. You can add lightbox=1 to the shortcode and it will do the rest automatically.
2. We have a full featured API for displaying lightbox. Please see it.
https://buddydev.com/mediapress/topics/api-guides/lightbox/mediapress-lightbox-javascript-api/
Hope that helps.
You must be logged in to reply to this topic.