I am trying to make it so that my custom post_type's will output in my pagination loop on the main page of my Wordpress site X amount of posts. However, it's not working.
Here is my code;
<?php if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); } else if ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); } else { $paged = 1; }
$my_query = new WP_Query ( array (
'post_type' => array ( 'reviews', 'blogtours', 'interviews', 'post' ),
'posts_per_page' => array( '1', '5', '0', '0' ),
'paged' => $paged, ) );
while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
I set 'interviews' and 'post' to 0 right now because they don't have any yet. I even tried removing them, thinking you couldn't set a post_per_page to 0 and that didn't work either (removing them from both posts_per_page and post_type).
The only thing that has worked so far is if I change;
'posts_per_page' => array( '1', '5', '0', '0' ),
to
'posts_per_page' => 3,
As an example. Then, it DOES show 3 posts, but in general from ALL post_types which is what I don't want. I want to be able to have it select from individual post_type. Because the "blogtours" post_type is going to have far more than any other and if I don't limit it to a smaller number, the other post_types will never been seen (unless you go to the front page, but I do a lot of posts per day so even that isn't feasible).
Any help would be most appreciated!