Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1147811

    Hi, i would like to open links in a new tab with gallery masonry but only a specific one gallery. I found this code but it applies to all gallery masonry:

    function add_custom_target(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery(‘.av-masonry-container a ‘).attr(‘target’,’_blank’);
    });
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘add_custom_target’);

    How to identifies a specific one gallery?

    Thanks,

    #1148509

    Hey Marc,

    You need to use the page-id class and the masonry class or id whichever is there.
    Image 2019-10-16 at 18.07.07.png
    Image 2019-10-16 at 18.07.44.png

    
    jQuery('.page-id-234 #av-masonry-1 .av-masonry-container a ').attr('target', '_blank');
    

    Best regards,
    Victoria

    #1150942

    Thanks Victoria!

    #1151072

    Hi,

    Great, I’m glad that Victoria could help you out. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1151121

    You can close it.

    Thanks,

    #1151150

    Hi mllibre,

    Great :) We are closing the thread.

    Best regards,
    Victoria

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Gallery masonry open new tab’ is closed to new replies.