Pagination
-
I was wondering if someone could help me figure out what I am doing wrong. I’m trying to create a pagination loop for custom post types to include post (if possible) along with my custom post types. I’ve tried it without post, with JUST post, with JUST a custom post type, and still nothing.
<?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' => 'reviews', 'posts_per_page' => 10, 'paged' => $paged, ) ); while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
I actually did get it working now, where it works if it’s just “reviews”. However, if I edit the post_type field to;
'post_type' => 'reviews', 'blogtours',
Then it stops working altogether which I’m sure is because I need to have it as something else, some sort of extra array so it picks up multiple post_types at once? I’m just not good at arrays. I’m usually okay with coding as a rule but arrays is one area that always throws me (plus my current situation personally has made my brain mush so even the little things are hard lately, lol).
Any/all help would be MOST appreciated.
- The topic ‘Pagination’ is closed to new replies.