WordPress tutorials: Replace read more link

Wpsnipp – Adding this code to your functions.php file of your wordpress theme will allow you to replace the read more link.The “more” tag is indeed very useful in WordPress because it allow you to define a portion of post to be displayed on your blog homepage. Though, the problem with the “more” link is that you can’t change its text. Excepted if yoou apply this recipe.

 

 

<?php
$custom_more = "Continue reading this post";
add_filter( 'the_content_more_link', 'my_more_link', 10, 2 );
function my_more_link( $more_link, $more_link_text ) {
return str_replace( $more_link_text, $custom_more, $more_link );
}
?>

Be Sociable, Share!

Leave a comment