Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #240183

    Zeshan
    Member

    Hi there,

    Thanks for writing in!

    You cannot add a custom class to your portfolio item, it’s adding dynamically. So, if you wish to open all your portfolio items in a new window? If so, you can use following code under Custom > JavaScript in the Customizer:

    (function($){ 
      $('.entry-thumb').attr('target', '_blank');
    })(jQuery);
    

    If you wish to target individual portfolio item, you can use their unique classes (see: http://prntscr.com/6oaf3x). So, review our KB article to locate post ids (same procedure for portfolio items): https://theme.co/x/member/kb/how-to-locate-post-ids/

    After that, you can use following code instead:

    (function($){ 
      $('.post-3570 .entry-thumb').attr('target', '_blank');
    })(jQuery);
    

    Replace 3570 with your post/portfolio item ID.

    Hope this helps. 🙂

    Thank you.

    #651928

    Tim
    Participant

    This custom code does not seems to open the link in a new tab:

    (function($){ 
      $('.entry-thumb').attr('target', '_blank');
    })(jQuery);

    Any ideas? It is opening the link on all portfolio items, but not in a new tab..

    http://nlfire-hardieres.savviihq.com/merken/

    Have a look @ the last item

    Thanks

    #651996

    Christopher
    Moderator

    Hi there,

    Please remove previous code and add this one :

    jQuery(".page-template-template-layout-portfolio-php .entry-featured a").attr("target","_blank");

    Hope that helps.