Thesis Tip #8 – Change Next and Previous Post Text

by Bill Erickson on December 10, 2009

Post image for Thesis Tip #8 – Change Next and Previous Post Text

The Previous Post and Next Post links are generated by the function thesis_prev_next_posts(). So to change the text, we’ll remove that function, create a custom function that duplicates it (but with our modifications), and then add it back where the original function was. In this example I’m going to change “Previous Post / Next Post” to just “Previous / Next” (see the bold text).

function custom_prev_next_posts() {

global $thesis;

if (is_single() && $thesis['display']['posts']['nav']) {
$previous = get_previous_post();
$next = get_next_post();

if ($previous || $next) {
echo '<div class="prev_next post_nav">' . "\n";

if ($previous) {
if ($previous && $next)
$add_class = '';

echo '<p class="previous" >' . __('Previous:', 'thesis') . ' ';
previous_post_link('%link', '%title');
echo '</p>' . "\n";
}

if ($next) {
echo '<p>' . __('Next:', 'thesis') . ' ';
next_post_link('%link', '%title');
echo '</p>' . "\n";
}

echo '</div>' . "\n";
}
}
}
remove_action('thesis_hook_after_content','thesis_prev_next_posts');
add_action('thesis_hook_after_content','custom_prev_next_posts');

All Thesis Tips:

Bill Erickson is a WordPress Consultant who builds custom websites using WordPress as a CMS and Thesis as a framework. He’s a cofounder and resident of The Creative Space, and a cofounder of the BIL Conference (the open analog to the TED Conference).

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

{ 1 comment… read it below or add one }

Andrew January 13, 2010 at 1:52 am

This is classy. It works and I like it! Thank you.

Reply

Leave a Comment

Previous post:

Next post: