Change Next and Previous Post Text in Thesis

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.

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

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk

Reader Interactions

Comments are closed. Continue the conversation with me on Twitter: @billerickson

Comments

  1. 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