www.webdeveloper.com
Results 1 to 2 of 2

Thread: How to open a link in a new tab in wordpress

  1. #1
    Join Date
    Jun 2013
    Posts
    2

    Question How to open a link in a new tab in wordpress

    I have this plugin called xTechnos Redirect, that basically changes my links for posts to external links. What I can't figure out is how I get the external links to open in a new tab. I'm guessing it's something about adding the target="_blank" somewhere, but the function doesn't have an .

    Here's the code

    Code:
    require_once(ABSPATH . '/wp-config.php');
    add_action('get_header', 'redirect');
    function redirect () {
        global $post;
        if (is_page()) {
            if (get_post_meta($post->ID, 'redirect', true)) {
                header('Location: ' . get_post_meta($post->ID, 'redirect', true));
            }
        }elseif(is_object($post) && !is_front_page()){
            if (get_post_meta($post->ID, 'redirect', true)) {
                header('Location: ' . get_post_meta($post->ID, 'redirect', true));
            }           
        }
    }

  2. #2
    Join Date
    Jun 2013
    Posts
    2
    Oops, it was meant to end this way:
    I'm guessing it's something about adding the target="_blank" somewhere, but the function doesn't have an
    <a href>
    .

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles