Want use GD Lightbox for single detail place content images
This topic contains 13 replies, has 3 voices, and was last updated by Naveen Giri 4 years, 7 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
April 10, 2020 at 6:23 pm #539525
Hello,
I just want use the lightbox effect from GD to images on my content description of a single place.
I tried “gd-lity” or “lightbox” classes used by GeoDirectory, no success.
Please don’t tell me that I have to install my own lightbox script for this simple need? The GeoDirectory lightbox is enough.
Thank you.
April 10, 2020 at 6:24 pm #539526This reply has been marked as private.April 10, 2020 at 7:13 pm #539530This reply has been marked as private.April 15, 2020 at 8:21 pm #540429This reply has been marked as private.April 16, 2020 at 4:14 am #540527Hi Adrien,
Please include data-lity attribute in link of that image.
It will open up the lightbox.Regards
NaveenApril 16, 2020 at 5:23 am #540536Thank you very much for your answer Naveen 😉
Yes by adding “data-lity” in my link, the lightbox works!
But do I have to manually add this for all the images in each post? Is it not possible to activate the lightbox on ALL images that are in the content of each single place descriptions?
I would be delighted not to have to install an additional plugin to simply have an already existing lightbox on the images of my content. It makes sense ?
Thanks.
April 16, 2020 at 6:30 am #540538Hi Adrien,
I saw you have already wrapped a few images in the anchor tag. you can remove them from anchor tags.
Please use the following PHP code snippet to make every image in place content.
add_action( 'wp_head', function () { ?> <script> // script to wrap every img in litty popup anchor. jQuery('.entry-content .geodir-field-post_content img').each(function(){ var href = jQuery(this).attr('src'); jQuery(this).wrap( "<a href='"+ href +"'></div>" ); }); </script> <?php } );
April 17, 2020 at 11:29 am #540845Thank you very much Naveen for yur help!
I didn’t know how to add your code in functions.php, because my plugin which manages functions.php does not allow me to close the php tag…
But adding it in my custom.js it worked thanks.For others, here the final code with the gd-lity parameter:
<script> // Add automatically link + lightbox to description content of single places jQuery('.entry-content .geodir-field-post_content img').each(function(){ var href = jQuery(this).attr('src'); jQuery(this).wrap( "<a href='"+ href +"'></div>" ); }); </script>
Cheers 😉
April 17, 2020 at 11:37 am #540846Hi Adrien,
we use the following guidelines for adding custom code.
https://wpgeodirectory.com/docs-v2/faq/customizing/#snippetsbut seems you already found a way. Thanks for sharing it.
have a great day.
Regards
Naveen GiriApril 17, 2020 at 11:48 am #540848Oops here the true code with the parameter, I can’t edit my last post about that:
<script> // Add automatically link + lightbox to description content of single places jQuery('.entry-content .geodir-field-post_content img').each(function(){ var href = jQuery(this).attr('src'); jQuery(this).wrap( "<a href='"+ href +"'></div>" ); }); </script>
The string “gd-lity” is censured on the forum?!
Edit: That’s crazy lol, the forum automatically delete the “gd-lity” parameter on this code, so this code is false ^^
April 17, 2020 at 11:48 am #540849This reply has been marked as private.April 17, 2020 at 12:15 pm #540856I am not sure I got the problem.
can you please explain it more.a screenshot or videos will also helpful?
Thanks
April 17, 2020 at 12:36 pm #540864I am not sure if a video is necessary.
Indeed it is simple, if you go to this link:
The photo gallery appears twice on the page:
1) One time on the top of the page, the carousel.
2) One time on the bottom of the right sidebar.If I click on a photo from carousel, that open the photo with the lightbox, but only the first 20 photo appears when I slide.
If I click a photo from the sidebar, all photos appears when I slide.
April 17, 2020 at 1:03 pm #540875Ok, I see.
Please try below shortcode or use shortcode builder to create a shortcode.
if you still have the problem, Please share site admin credentials in a private reply.
I will check the settings.[gd_post_images title='' type='slider' types='post_images' fallback_types='logo,cat_default,cpt_default,listing_default' image_size='full' css_class='listing-cover-image' ]
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket