-
AuthorPosts
-
February 13, 2019 at 9:38 pm #1066651
Hi, how can I open the portfolio entries in a masonry element in a new tab?
Thanks.
February 14, 2019 at 12:10 am #1066691give a custom-class to the masonry you like to have that. f.e.: masonry-blank
then this comes to functions.php of your child-themefunction add_custom_target(){ ?> <script> (function($){ $(window).load(function() { $('.masonry-blank a').attr('target','_blank'); }); })(jQuery); </script> <?php } add_action('wp_footer', 'add_custom_target');
February 14, 2019 at 7:15 am #1066818Masonry element for portfolio items, not gallery.
February 14, 2019 at 9:28 am #1066854yes – is that a portfolio masonry: https://webers-testseite.de/portfolio/
and do they open in a new tab?February 14, 2019 at 11:05 am #1066896That’s my question. How do I make them open in a new tab.
February 14, 2019 at 11:50 am #1066910you see the code?
as described above : give a custom class to the masonry element – I used to test: masonry-blankThe code above comes to child-theme functions.php
the function name and the custom-class are arbitraryfunction add_target_blank_to_masonry_items(){ ?> <script> (function($){ $(window).load(function() { $('.masonry-blank a').attr('target','_blank'); }); })(jQuery); </script> <?php } add_action('wp_footer', 'add_target_blank_to_masonry_items');
thats all – don’t forget to refresh all cachings and if you use merging on Enfold – recalculate the merged files.
February 14, 2019 at 9:59 pm #1067162Hi bakbek,
@Guenni007 thank you for the input.Please let us know if you got it working for you or if you need more help.
Best regards,
VictoriaFebruary 20, 2019 at 10:10 pm #1069710Hi Victoria, I was wondering the same thing. Is there a way to add this code to only 1 specific masonary gallery? I have multiple masonary galleries and they are all fine. I have just one that I want all of the links to open in a different tab (because they are going to another site). Please advise.
February 24, 2019 at 8:59 pm #1071024Hi,
You can add a custom CSS class to the row that has the masonry inside and then add this class also to the JS
Best regards,
BasilisFebruary 26, 2019 at 7:01 pm #1071917SO what is the custom css? Is there instructions on how to do this somewhere?
March 1, 2019 at 5:27 pm #1073285Hi jeffoleary,
Yes, you can use the page id class and the masonry id to uniquely identify just that masonry.
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.