Tagged: 

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #604711

    I have set this site, and in several pages I have use a portfolio with a image that have a link, and I would like that this url will open in a new window, but there is not the posibility in the portfolio. I have tried adding a code target=_blank, but I do not if do wrong; but it does not work.

    The site is this one:
    http://www.distritohm.com/

    Thanks.

    #604725

    Hey hector1069!

    Please turn on custom CSS field for ALB elements – kriesi.at/documentation/enfold/turn-on-custom-css-field-for-all-alb-elements/ and then edit your element and give it a custom CSS class and then add following code to Functions.php file in Appearance > Editor

    function my_custom_target(){
    ?>
     <script>
    jQuery(window).load(function(){
    jQuery('.your-custom-class a').attr('target','_blank');
    });
     </script>
    <?php
    }
    add_action('wp_footer', 'my_custom_target');

    Regards,
    Yigit

    #604729

    Does your code look like this?

    <a href="http://www.example.com" target="_blank">Click Me</a>

    #604749

    Yes, my code was like that, I wrote it on portfolio link gap, but it did not work.

    Now, I have done what you told me but, it does not work… and in the template appear a weird code (see image).

    I give you my logincredentials if you want to check it.

    #605407

    Hi!

    your login link does not work. Can you check please?

    Best regards,
    Andy

    #605470

    I send you the link again.

    Thanks

    #606427

    Hey!

    I changed the code in Functions.php file to following one

    
    function my_custom_target(){
    ?>
     <script>
    jQuery(window).load(function(){
    jQuery('.custom-element a').attr('target','_blank');
    });
     </script>
    <?php
    }
    add_action('wp_footer', 'my_custom_target');

    and added custom class to your element on your “workspaces” page – http://i.imgur.com/hkSdIQB.png
    Please review your website now and apply the same class to your other element where you would like to open in new tab

    Cheers!
    Yigit

    #606603

    Hi Yigit,

    It is almost perfect. A weird thing happens when you make click on the image the first time do not open in a new window, but the second do it perfectly.

    What can it happen?

    Cheers!
    Almudena.

    #606630

    Hey!

    Page should be loaded for it to work properly :)

    Best regards,
    Yigit

    #606650

    Hi Yigit!!

    Ok. Thanks a lot and have a good day.
    Almudena

    #606657

    Hey Almudena!

    You are welcome! You too have a good day and let us know if you have any other questions or issues

    Best regards,
    Yigit

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Link in a new page’ is closed to new replies.