Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1286682

    Hello,

    on my site https://datagrafik.de I want to open some of the Links of my Portfolio Items in a new window.

    What can I do?
    Thanks for Feedback
    Bernd

    #1287483

    Hi Bernd,

    I tried to access using the credentials however it doesn’t work, please check.
    Here’s a code you can add in functions.php but we advise putting it in a child theme’s functions.php so the tweak won’t be lost during a theme update.
    You can download and find instructions on how to use a child theme here (skip this step if you have one): https://kriesi.at/documentation/enfold/child-theme/
    This code will open links in new tab if it’s an external link:

    function masonry_links () {
    ?>
    <script>
    (function ($) {
        $(document).ready (function () {
            var url = new RegExp(location.host);
    
            $('.av-masonry-entry').each(function () {
                if( ! url.test($(this).attr('href')) ) {
                    $(this).attr('target', '_blank');
                }
            });
        });
    }) (jQuery);
    </script>
    <?php
    }
    add_action ('wp_footer', 'masonry_links');

    Hope this helps.

    Best regards,
    Nikko

    #1287491

    Hey Nikko!
    Exactly what I wanted, phantastic!
    Thank you very much
    Bernd

    #1287562

    Hi Bernd,

    We’re glad that we could help :)
    Thanks for using Enfold and have a great day!

    Best regards,
    Nikko

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Open Portfolio Link in a new Window?’ is closed to new replies.