Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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;
}
share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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