0

This code worked perfectly! But my issues is that it removes text on pages. I just need the page numbering to appear immediately after the post and not at the bottom of the page. Any suggestions?

add_filter ('the_content', 'pagination_after_post',1);
function pagination_after_post($content) {
   if(is_single()) {
      $content.= '<div class="pagination">' . wp_link_pages('before=&after=&next_or_number=next&nextpagelink=Next&previouspagelink=Previous') . '</div>';
   }
   return $content;
}

1 Answer 1

0

Your call of wp_link_pages displays navigation immediately because echo argument is set to 1 by default, and it means to echo result. So try to add &echo=0 at the ennd of wp_link_pages call:

add_filter ('the_content', 'pagination_after_post',1);
function pagination_after_post($content) {
   if(is_single()) {
      $content.= '<div class="pagination">' . wp_link_pages('before=&after=&next_or_number=next&nextpagelink=Next&previouspagelink=Previous&echo=0') . '</div>';
   }
   return $content;
}

Read more about wp_link_pages parameters in codex.

2
  • Awesome but now it removes all of the text from my pages after adding this code to function.php any suggestions.... Jun 8, 2012 at 12:12
  • It's working now! I misplaced a quotation mark. Thanks so much! Jun 8, 2012 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.