
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.

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.
Nothing hard here. All you have to do is to define the desired text for your more link on line 3, and then paste the code snippet on your functions.php file.
<?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 );
}
?>
That's all. Using the power of hooks, you have defined a new text for the more link.
Credits goes to Justin Tadlock for this great recipe!
19 Responses
Hey, what doe’s it mean “you can’t change its text”? I can do it in the_content(‘READ MORE TEXT’)!
I’d like to point out that the filter the_content_more_link was recently introduced in WordPress 2.8.
Is there a way to have the read more always be there even if there isn’t any more text beyond what you see? I’ve got a site where the owner posts tons of pictures and often little text. In order to make the site more “friendly” I changed it so that only one picture shows up per post on the main page. In order for people to know that there is more pictures I setup the excerpt function, but the problem is that there isn’t always enough text to produce a read me. So is there a way to have it show the read more regardless?
There’s a common trick – you can change MORE text easily if you just type your text after a space in a MORE tage
<–more Keep reading, folks –>
@Elio: Didn’t know that! Thanks for notifying me!
@seezer Great Tip!
@Vanilla Man – This tutorial was taken a bit out of context. If you read the original article, you’ll see why this filter hook is important.
Don’t forget you can style this text with the class .more-link
Great tip and also thanks to seezer
Very nice tip for older versions of WordPress. Thanks for sharing.
Thanks.
Nice tip, re-tweet it now.
Great tip. I guess it’s better than using plugins sometimes. I notice it makes the blog run slow.
Hi,
Its surprisingly simple.
I try it on my WP blog.
Thanks.
Um, where the heck do we modify this?? I’ve searched in function, index, single, everywhere. I want to change it from saying “Keep Reading” to something else…
Neon: You don’t modify something unless it is already in your functions. What you want to do is copy this and then paste it into your functions.php file.
@Nori Silverrage THANKS!
how can I make the function work in current version wp.org on a page!! I am a novice!
Thnx.
There is another method also
function more_text_image() {
$content = ‘Here goes your Text or HTML markup if you want to put up an image’;
return $content;
}
add_filter(‘more_text’, more_text_image);
Hope this will help
Trackbacks: