Custom Post Type Archive Page: Set Posts Per Page, Paginate

The code in the link you posted will (using pre_get_posts) will always change the number of posts_per_page to 3 if you are querying posts from that type. So a better solution would be to not use that code and simply above you code, before :

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

add:

if ( get_query_var('paged') )
    $paged = get_query_var('paged');
elseif ( get_query_var('page') )
    $paged = get_query_var('page');
else
    $paged = 1;
query_posts(array('post_type' => 'video', 'posts_per_page' => '3', 'paged' => $paged ));

and this will only effect that query and not all queries of that post type.

Update:

the structure of your code should look like this:

if ( get_query_var('paged') )
    $paged = get_query_var('paged');
elseif ( get_query_var('page') )
    $paged = get_query_var('page');
else
    $paged = 1;
query_posts(array('post_type' => 'video', 'posts_per_page' => '3', 'paged' => $paged ));
while( have_posts() ) : the_post(); 
    //MAIN LOOP...
endwhile; wp_reset_query(); 

next_posts_link(); previous_posts_link(); 

$custom_loop = new WP_Query( array('post_type' => 'video', 'posts_per_page' => '-1' ) );
while ( $custom_loop->have_posts() ) : $custom_loop->the_post();
    //CUSTOM LOOP...
endwhile;
wp_reset_query(); 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)