WordPress.org

Ready to get started?Download WordPress

Forums

Network Latest Posts
[resolved] How to add target=blank to post URLs? (4 posts)

  1. csigncsign
    Member
    Posted 2 years ago #

    Hi,

    I use your plugin to show on my main blog some posts' excerpts of my sub-blogs.

    Now I would like that these posts are opening in a new window, because they're coming from another blog.

    How can I add to them a target="_blank" to their URL?

    Thanks.

    http://wordpress.org/extend/plugins/network-latest-posts/

  2. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 2 years ago #

    Hello,

    Well, you could use jQuery for that, just add this to your theme's header.php inside the <head></head> tags the code below:

    <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/js/nlp_extlinks.js"></script>

    Then create a new file called nlp_extlinks.js inside the js folder (if it doesn't exist you can create one) inside your active theme's folder, and put this inside:

    jQuery(document).ready(function(){
        jQuery('.nlposts-wrapper a').attr('target', '_blank');
    });

    That's it, save and close. It will add the target="_blank" to all links inside nlposts-wrapper.

    Cheers.

  3. Macfionn
    Member
    Posted 2 years ago #

    Awesome support, Jose!

  4. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 2 years ago #

    Hey Mac, thanks for your comment. I'm glad to help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic