Adding buttons to a Page for previous and next sets of posts (2 posts)

  1. Krommdor
    Posted 1 year ago #

    I am using the Twenty Ten theme and playing around with this page for work purposes.

    On my Homepage (not static) ALL Posts show up, and there are buttons I altered with the TW Pagination plugin to navigate forward and backward between Pages of Posts.

    I have a Page called Podcasts with Posts being redirected to show up based off Category.

    Once the page limit of 15 is reached, all prior content is not visible.
    I want these Navigation buttons to show up on this Page. How do I make that happen? I am at a loss.

    If someone could directly tell me what code needs to be changed or removed that would be excellent.

    They are all test posts and if you look between Home and Podcasts on the navigation you will see my issue. Here is the link to the page starting with the one that does NOT have the buttons.

  2. vtxyzzy
    Posted 1 year ago #

    In order for pagination to work, you must get the current page number and include that in the query that retrieves the posts, similar to this:

    // Get the current page
    $paged = (get_query_var('paged')) ? get_query_var('paged') :
       ((get_query_var('page')) ? get_query_var('page') : 1);
    // Include it in the query arguments
    $args = array(
       'posts_per_page' => 10,
       'paged' => $paged,
       // All your other query args here
    $myquery = new WP_Query($args);

    Then you display the links using either a plugin like WP PageNavi, or the WP functions next_posts_link() and previous_posts_link().

Topic Closed

This topic has been closed to new replies.

About this Topic