Display different quantities of post per page (1 post)

  1. Justin Tucker
    Posted 4 years ago #

    I've got the WP-PageNavi plugin working fine, but had a question about modifying how many posts are displayed per page.

    Here is the loop I'm using.

              $args = array(
                'post_type' => 'commercial,
                'posts_per_page' => 4,
                'paged' => get_query_var('paged')
              $my_query = new WP_Query( $args );
              while ( $my_query->have_posts() ) : $my_query->the_post();
             <!-- post info here -->
            <?php endwhile; ?>

    My overall goal is to display 2 posts on the first page and 8 posts on any of the subsequent paginated pages. I've use the if_paged() method to modify the posts_per_page variable, but the pagination gets messed up. Has anyone had any results with something like this?


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic