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
  • Author
    Posts
  • #539525

    Brigitte
    Expired Member
    Post count: 235

    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.

    #539526

    Brigitte
    Expired Member
    Post count: 235
    This reply has been marked as private.
    #539530

    Kor
    Moderator
    Post count: 16516
    This reply has been marked as private.
    #540429

    Brigitte
    Expired Member
    Post count: 235
    This reply has been marked as private.
    #540527

    Naveen Giri
    Moderator
    Post count: 1559

    Hi Adrien,

    Please include data-lity attribute in link of that image.
    It will open up the lightbox.

    Regards
    Naveen

    #540536

    Brigitte
    Expired Member
    Post count: 235

    Thank 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.

    #540538

    Naveen Giri
    Moderator
    Post count: 1559

    Hi 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 } );
    
    #540845

    Brigitte
    Expired Member
    Post count: 235

    Thank 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 😉

    #540846

    Naveen Giri
    Moderator
    Post count: 1559

    Hi Adrien,

    we use the following guidelines for adding custom code.
    https://wpgeodirectory.com/docs-v2/faq/customizing/#snippets

    but seems you already found a way. Thanks for sharing it.

    have a great day.

    Regards
    Naveen Giri

    #540848

    Brigitte
    Expired Member
    Post count: 235

    Oops 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 ^^

    #540849

    Brigitte
    Expired Member
    Post count: 235
    This reply has been marked as private.
    #540856

    Naveen Giri
    Moderator
    Post count: 1559

    I am not sure I got the problem.
    can you please explain it more.

    a screenshot or videos will also helpful?

    Thanks

    #540864

    Brigitte
    Expired Member
    Post count: 235

    I am not sure if a video is necessary.

    Indeed it is simple, if you go to this link:

    https://accentsduterroir.fr/producteurs/artisans-textile/provence-alpes-cote-dazur/briancon/all-colors-are-beautiful/

    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.

    #540875

    Naveen Giri
    Moderator
    Post count: 1559

    Ok, 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' ]
    
Viewing 14 posts - 1 through 14 (of 14 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount