
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!
One Response
Great tip, thanks to both you and Chris C. I just got this working in my theme and am going to thoroughly enjoy finally being able to break about from the doldrums of “Read More…”
P.S. You consistently publish some of my favorite WP tutorials on the web. Thanks for the great work.
Trackbacks: