I am using the_excerpt()
to display an excerpt for a custom post.
I then use this code to change the default "Continued" link to "Read more" which is working fine:
function bm_excerpt_more_link( $excerpt ){
$post = get_post();
$excerpt .= '<a href="'. get_permalink($post->ID) . '">Read more</a>';
return $excerpt;
}
add_filter( 'the_excerpt', 'bm_excerpt_more_link', 21 );
However the "Read more" link is shown on the next line, outside the excerpt's <p>
tag.
E.g.
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<a href="http://mytheme.dev/news-post-five/">Read more</a>
Is it possible to keep the "Read more" text on the same line as the excerpt, within the <p>
tag of the excerpt, in the same way as the default "Continued" link?
E.g.
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua … <a
href="http://mytheme.dev/news-post-five/">Continued</a></p>
Thanks very much!