WordPress.org

Support

Support » How-To and Troubleshooting » How to get ‘continue reading’ read more to open in new window?

How to get ‘continue reading’ read more to open in new window?

  • I know that target=”_blank” open a link in a new window. My question is where do I place it in order to have the link open in a new window when the ‘continue reading’ link is clicked after the post excerpt on the blog homepage?

    Help please?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Might get some ideas in Customizing_the_Read_More.

    It will be something like this:

    <a href="<?php the_permalink() ?>">Continue ...</a>

    turn it to:

    <a target="_blank" href="<?php the_permalink() ?>">Continue ...</a>

    Try a filter (tested this with WordPress Default theme by adding to functions.php in wp-content/themes/default/functions.php):

    //make more link open in new window
    function add_blank_to_link($link) {
    $pos = strpos($link, 'a href');
    if ($pos) {
    $link = substr_replace($link, 'a target="_blank" href', $pos, 6);
    }
    return $link;
    }
    add_filter('the_content_more_link', 'add_blank_to_link');
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to get ‘continue reading’ read more to open in new window?’ is closed to new replies.