
The “more” link is indeed a great WordPress capability, which allow you to choose the part of the post to be displayed on the homepage. Then, a “Read more” link is displayed. But how can you change the text of this link? Just read on.

The “more” link is indeed a great WordPress capability, which allow you to choose the part of the post to be displayed on the homepage. Then, a “Read more” link is displayed. But how can you change the text of this link? Just read on.
To achieve this recipe, the first step is to edit your posts and create custom fields. Give them custom_more as a key, and the text to display as a value.
Once done, edit your index.php file (As well as category.php, search.php, etc) and find a line similar to this:
the_content("Read more");
Simply replace it with this code:
<?php $custommore = get_post_meta($post->ID, 'custom_more', true); ?>
<?php if (!$custommore) { $custommore = 'Read More »'; } ?>
<?php the_content($custommore); ?>
That's all. Now, if you create a custom field named custom_more, its value will be displayed instead of the classic "Read more" link.
Thanks to Chris Cagle for this very usefull trick!
9 Responses
Nice, but the trick I like best is that you can add text to the {!–more–}-tag to get whatever ‘read more’-message you want.
{!–more read 1,000 words more–}
{!–more not a whole lot more–} etc.
[Where { is used, use <]
can it be done without custom field?
Nice tip. Thanks a lot.
As IJsbrand is stating in the first comment all of this is built in in Wordpress already. No need for custom fields at all.
Nice tip! Been looking for something like this..
2sms:
just replace
the_content(“Read more”);
“Read more” with whatever you want.
Thank you for this recipe! It worked like a charm and was EXACTLY what I needed!
Trackbacks: