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;
}
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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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