Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #639210

    Hi,
    I have the following website page dedicated to a sports event Sponsors.
    http://ironmanech.com/sponsors/

    Sponsors appear on that page through a picture Gallery and their logo is linked to their website.
    I insert their url in the picture in the media library, for ex. for color sport, I’ve populate the personalized link” of their logo as http://www.colorsport-event.com/

    How can I force the link to open in a new browser thumbnail instead of the same one which make them leave my site?
    I though to modify the “Personalized link” to tell him to “target a new window”.

    Thanks.
    JM

    #639574

    Hi,

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

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

    That will make all external links to open in a new page.

    Regards,
    Josue

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