Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #694371

    Hello, I have been searching threads on this topic but can’t find a solution that seems to work for me. The threads seem to be older. I would like the image links in the masonry portfolio to open to a new tab. Is there some code I could work with to make this happen? I am using version 3.8

    • This topic was modified 8 years, 1 month ago by Tate.
    #695059

    Hey Karen,

    Please edit your masonry element and give it a unique ID and then add following code to Functions.php file in Appearance > Editor

    function avia_masonry_target(){
    ?>
     <script>
    jQuery(window).load(function(){
    jQuery('#your-custom-id a').attr('target','_blank');
    });
     </script>
    <?php
    }
    add_action('wp_footer', 'avia_masonry_target');

    If you need further assistance, please create a temporary admin login and post it here privately when you launch your website.

    Best regards,
    Yigit

    #695195

    Thanks Yigit,

    So just to clarify: if I use the word gallery for my id in the masonry element, then in functions.php would look like this: (‘#gallery a’) .
    I am also using a child theme so would this be put in a functions.php file in the child theme?

    Kind Regards,
    Karen

    #695205

    Hi,

    Answer is yes to both of your questions :)

    Best regards,
    Yigit

    #695789

    Hi Yigit,
    So I have added the suggested code into the functions.php file in the child theme. Unfortunately it is still not working.
    I have launched a demo site so you can have a look.
    login details below.

    Kind Regards

    Karen

    #695794

    Hi,

    ID is not being applied. I changed the code to following to target color section element your links are in

    function avia_masonry_target(){
    ?>
     <script>
    jQuery(window).load(function(){
    jQuery('#projects a').attr('target','_blank');
    });
     </script>
    <?php
    }
    add_action('wp_footer', 'avia_masonry_target');

    Please review your website now

    Best regards,
    Yigit

    #695803

    Hi Yigit,
    Thank you! I thought I was to add the ID to the masonry element so I must have misunderstood.

    I did have an ID in the color section for the main menu anchor (projects). That is also not working. I was going to open a new thread but if you are able to help me with that as well that would be great. When I click on the main menu items they are not scrolling to the identified section. I have used the one page website on other sites before and have had no trouble with the anchors. If you would like me to open a new thread I can do that too.

    K.

    #696871

    Hey!

    Yes, please open a new thread for other inquiries. Thank you! :)

    Cheers!
    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Need portfolio masonry grid link to open in new tab’ is closed to new replies.