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?
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?
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');This topic has been closed to new replies.