Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #272453

    Hi,
    I would like to open external links on a new tab or window.
    I found this thread : http://www.kriesi.at/support/topic/i-want-that-external-links-links-to-other-websites-open-in-a-new-windowtab/?login_error
    but I don’t have the file custom.js
    So How can I do ?
    Thanks

    #272601

    Hi,

    Try adding this at the very end of your theme functions.php file:

    function add_custom_script(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery("a[href^='http:']").not("[href*='mydomain.com']").attr('target','_blank');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Change mydomain.com by your domain.

    Regards,
    Josue

    #273788
    This reply has been marked as private.
    #273790
    This reply has been marked as private.
    #273818

    Hey!

    Please try adding following code to Functions.php file

    function add_custom_script(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery(".portfolio-meta-value a").attr("target", "_blank");
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Best regards,
    Yigit

    #276439

    Hi Yigit,
    Perfect !
    Thanks a lot

    #276442

    Sorry Yigit,
    I have not fully tested, but it does not work.
    Thanks

    #276457

    Hi!

    Please open up coherence/functions-coherence.php and replace:

    
    $p_metas[$counter] = "<a href='".$p_metas[$counter]."'>".$linktext."</a>";
    

    with

    
    $p_metas[$counter] = "<a target='_blank' href='".$p_metas[$counter]."'>".$linktext."</a>";
    

    Cheers!
    Peter

    #279697

    Hi Dude,
    now it’s good !
    Thanks

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘portfolio external links on new tab or window’ is closed to new replies.