WordPress Pagination

Pagination

  • Break up a post using <//!–nextpage–> (remove //)
    • The loop must have the wp_link_pages function in it.
  • When multiple loops are used in a theme template only the main loop can be paginated.
  • Simple Pagination
    • Put in after loop: posts_nav_link();
    • For a little more control use: next_posts_link() and prev_posts_link()
    • To pass pagination links to a PHP variable use get_next_posts_link() and get_previous_posts_link()
  • Numerical Pagination  – Use the_posts_pagination();
  • Between Single Posts – next_posts_link() and prev_posts_link()