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

    Hey there, is there a way to set all links as tagert=”_blank” Links. That is to say links open in new window as a standard
    and i can manually change this setting? At the moment its the other way around.

    Thank you very much!

    All the best and it depends where u come from: Happy Halloween ;-)
    tob

    • This topic was modified 8 years, 1 month ago by Tobiy.
    #705800

    Hey Tobiy,

    Please try adding this at the very end of your themes / child themes functions.php file:

    // open in new window
    function newWindow(){
    ?>
    <script>
    jQuery(document).ready(function() {     	
         	jQuery('#main a').each(function () {
        		jQuery(this).attr('target','_blank');
    	 });				
    }); 
    </script>
    <?php
    }
    add_action('wp_footer', 'newWindow');

    If you like to target specific links on the page. Please add a class name to the link and use the class name in the above provided code.

    Example : jQuery('#main a.custom_link').each(function () {

    Best regards,
    Vinay

    • This reply was modified 8 years, 1 month ago by Vinay.
    #705826

    Vinay, you have no idea how much time you saved me with this code. Thank you so much. Thank you :-)

    #706046

    Hi,

    Glad we could help! We really appreciate it if you rate our theme on themeforest https://themeforest.net/downloads
    To know more about enfold features please check – http://kriesi.at/documentation/enfold/
    Thank you for using Enfold :)

    Best regards,
    Vinay

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘all links target="_blank"’ is closed to new replies.