This post has been marked as old. The code might no longer work. Comments have been disabled as this is no longer maintained. Use the search on the right to find a newer tutorial.

Change Next and Previous Post Text in Thesis

mac

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');

Bill Erickson is a WordPress Consultant who builds custom websites using WordPress as a CMS and the Genesis framework. He contributes to the WordPress community through free themes, plugins, tutorials, and core patches. He's also a cofounder of the BIL Conference (the open analog to the TED Conference).

Looking for more great tutorials? See them all!

Comments

  1. Darcy Scott says:

    Thanks for this. But in which file do we make these modifications?

  2. Darcy Scott says:

    Thank you again.

  3. Pshemko says:

    It doesn’t work on my site. The links are gone.

  4. Heureux says:

    thanks for this post
    any idea of how to change the place of previous and next post on the page?
    i find weaver theme placement much much better and I’d like to have the same
    thanx