WordPress How To:Customizing Read More Links in WordPress

We have used WordPress for several years and have always been annoyed by the fact that the “Read More” or “Read the rest of this entry” link that displays when using excerpts on the home page, category pages and archive pages always jumped to...

Review published: August 13, 2009 · by admin · 0 Commments · Rate this theme

We have used WordPress for several years and have always been annoyed by the fact that the “Read More” or “Read the rest of this entry” link that displays when using excerpts on the home page, category pages and archive pages always jumped to the next block of text on a page using a bookmark link. We want the entire page to display, just like any other web page, and want users to start at the top. The solution has always required editing of the WordPress core code. WordPress 2.8 finally resolves this issue and editing of core files is no longer required.

WordPress 2.8 added the ability to modify the Read More link without having to modify the core files. Modifying the core files is always a nuisance and should be avoided whenever possible, because every time you upgrade WordPress, which could be 5 or 6 times per year, you have to modify the files again. The solution is found on a new WordPress codex page that includes other tips for modifying this link.
To remove the jump to the next block of text, the #more bookmark needs to be removed from the link leading to the post. To remove the bookmark, simply add the following function to the functions.php file found in your WordPress theme.

function remove_more_jump_link($link) {
$offset = strpos($link, ‘#more-’);
if ($offset) {
$end = strpos($link, ‘”‘,$offset);
}
if ($end) {
$link = substr_replace($link, ”, $offset, $end-$offset);
}
return $link;
}
add_filter(‘the_content_more_link’, ‘remove_more_jump_link’);

Customizing the Read More Links

If is also easy to customize the text in the Read More link to say almost anything you want it to say. The Default theme that comes with WordPress uses “Read the rest of this entry”. To change the text in this message, find the the_content function call in the appropriate theme script. The function argument can be changed to anything you want to use.

<?php the_content(”,FALSE,”"); ?>

There are three arguments to be passed. The first is empty and denoted by two single quotes, followed by a comma, followed by the word FALSE, followed by a comma, and then two more single quotes.

Get more information with http://wpstyles.org

Rate this theme!

No comments or ratings yet.

Choose a Rating

2016 © Please don't copy · Made in WordPress