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

    Hi guys ,
    I set a gallery masonry , which opened in an external link .
    Im using portfolio entries and I would like that the connection is opened in a new window.
    There is the possibility to open the title in a link different from that set for the photo?

    You can see here http://limodo.org/masonry-women/ in the last entry named “skirt”

    TY

    #465805

    Hey pistonluca!

    Please add following code to Functions.php file in Appearance > Editor

    function add_custom_target(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery('.home #av-masonry-1 a').attr('target','_blank');​
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_target');

    Best regards,
    Yigit

    #477567

    Hello Yigit,
    I don’t think this code would work for me. You see, I only need target=”_blank” IF the link is to an External URL. ( I am not a programmer, but I don’t think it will work for External link Only – correct?)
    I set Some of my posts with the Yoast 301 redirect – if the post is something published in another website.
    Additionally it is not clear to me Where in my functions.php file to add this type of code in.
    Thank you

    #478402

    Hi!

    Try changing the code to this:

    function add_custom_target(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery('.home #av-masonry-1 a:not([href^="http://limodo.org"]):not([href^="#"]):not([href^="/"])').attr('target','_blank');​
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_target');

    Putting at the end will do the job.

    Cheers!
    Josue

    #479496

    Thank you Josue for your quick response.
    I tried placing the above code at the bottom of my functions.php file, I cleared my cache and refreshed, and – no change…..

    I did change limodo.org to my URL. Additionally, I’m not sure what the significance in my case ” add_action(‘wp_footer’, ‘add_custom_target’);” is. So I tried to remove it as well, that did not work either.

    I tried this nice little script as well, ( I added it with a “add to header ” plugin ) It did not work
    <script>
    $(document).ready(function() {
    $( ‘a[href^=”http://”%5D&#8217; )
    .attr( ‘target’,’_blank’ )
    .addClass( ‘external_link’ )
    ;
    });
    </script>

    The posts that need to open in a new tab ( some are displayed on the home page, some are on the blog page) have the “yoast” 301 redirect set to an external URL. They are blogs that the author wrote – on other sites. So while he wants to list them here with his blogs, they do need to open in a new Tab, on the site they are published.
    Please Advise
    Thank you again for your persistent assistance!

    #479505

    Hi!

    Please post a link to the Page containing the masonry you want to affect.

    Cheers!
    Josue

    #479534

    http://webstrauss.com/ak/blog/
    http://webstrauss.com/ak
    There are some other pages as well, but I can just copy /edit the code you write . correct?
    Thank you again!!

    #479544

    I see, all blog links are within your domain and the “redirection” occurs later with a 301 rule, so there’s no way to identify these external links and apply the target attribute mod. You’ll need to re-think your approach, have you tried using Post formats (see “link” type)?

    Best regards,
    Josue

    #479954

    Hey Josue!
    Check this out!
    this awesome plug in did the trick!!
    Quick Page/Post Redirect Plugin
    Thanks again!!
    H

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Ajax question’ is closed to new replies.