Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1493688
    ThorstenFB
    Guest

    Hi,

    to open portfolio links in a new tab, I followed the instructions here: https://kriesi.at/support/topic/portfolio-custom-link-target_blank/#post-715795

    This works quite well so far. But portfolio entries that are loaded afterward (via the “load more” button) are still opened in the same tab.

    I would therefore appreciate your help.
    Thanks a lot!

    Thorsten

    #1493707

    Hey ThorstenFB,

    Thank you for the inquiry.

    Try to add this code to the functions.php file to re-apply the target attribute to the loaded portfolio items.

    add_action('wp_footer', function () {
        ?>
        <script>
            jQuery(function ($) {
    
                function applyMasonryTargetBlank() {
                    setTimeout(function () {
                        $('.av-masonry-entry a').attr('target', '_blank');
                    }, 500);
                }
    
                applyMasonryTargetBlank();
    
                $(window).on('debouncedresize', function () {
                    applyMasonryTargetBlank();
                });
    
            });
        </script>
        <?php
    }, 9999);
    

    Best regards,
    Ismael

    #1493711

    Hi Ismael,

    thanks for your help. Unfortunately this isn’t working on my site (see private content).
    Do you have an idea to resolve?

    Thanks a lot
    Thorsten

    #1493756

    Hi,

    Thank you for the update.

    It seems to be working when we tested it on our end. Please try to increase the timeout from 500 ms to 1000 ms or longer. If you can provide the login details in the private field, we’ll check the script further.

    Best regards,
    Ismael

    #1493766

    HI Ismael,

    thanks again for your help!
    I changed the timeout but the problem still exists.
    You see the login details in the private content.

    Best regards,
    Thorsten

    #1493770
    This reply has been marked as private.
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.