-1

I have a posts_per_page query to paginate multiple post types, which works great! Now though, as it paginates it to show (in this case) 100 posts per page, I'm wondering if you can show 100 on page one, then 300 on page 2 onwards. My markup is as follows:

<?php query_posts( array(
     'posts_per_page' => 100,
     'post_type' => array( 'regularproducts', 'wpsc-product' ),
     'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),
));
?>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <?php if ( 'regularproducts' == get_post_type()  ) : ?>

        //CONTENT HERE

    <?php endif; ?>

    <?php if ( 'wpsc-product' == get_post_type()  ) : ?>

        //CONTENT HERE

    <?php endif; ?>

<?php endwhile; endif; ?>

<?php wp_reset_query(); ?>

I'm not sure if it is at all possible or not, but yes I'd like to show 100 posts on the first page, and 300 on each page thereafter. Any suggestions would be greatly appreciated!

0

1 Answer 1

-1

Try this code here

<?php 
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
if($paged == 1){
    $posts_per_page = 100;  
}else{
    $posts_per_page = 300;
}
query_posts( array(
     'posts_per_page' => $posts_per_page,
     'post_type' => array( 'regularproducts', 'wpsc-product' ),
     'paged' => $paged,
));
?>
0

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