Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1066651

    Hi, how can I open the portfolio entries in a masonry element in a new tab?

    Thanks.

    #1066691

    give a custom-class to the masonry you like to have that. f.e.: masonry-blank
    then this comes to functions.php of your child-theme

    
    function add_custom_target(){
    ?>
    <script>
    (function($){
        $(window).load(function() {
          $('.masonry-blank a').attr('target','_blank');
        });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_target');
    #1066818

    Masonry element for portfolio items, not gallery.

    #1066854

    yes – is that a portfolio masonry: https://webers-testseite.de/portfolio/
    and do they open in a new tab?

    #1066896

    That’s my question. How do I make them open in a new tab.

    #1066910

    you see the code?
    as described above : give a custom class to the masonry element – I used to test: masonry-blank

    The code above comes to child-theme functions.php
    the function name and the custom-class are arbitrary

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

    #1067162

    Hi 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,
    Victoria

    #1069710

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

    #1071024

    Hi,

    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,
    Basilis

    #1071917

    SO what is the custom css? Is there instructions on how to do this somewhere?

    #1073285

    Hi 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

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.