Ok so, I have a page which shows a feed of posts in the "news" category (url is: mydomain.com/category/news ), but the client wants it to also show posts in the "press-releases" category.
So in the category.php page, I used the following code thinking it would loop through all posts which are either in the "news" or "press-release" category:
ob_start();
single_cat_title();
$this_cat = ob_get_contents();
ob_end_clean();
if( $this_cat == 'News' || $this_cat == 'Press Releases' ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'vacation_do_custom_loop' );
}
function vacation_do_custom_loop() {
global $wp_query;
global $paged; // current paginated page
global $query_args; // grab the current wp_query() args
$args = array(
'category__in' => '5, 1', // i also tried 'category_name' => 'news, press-releases'
'posts_per_page' => 9,
'paged' => $paged // respect pagination
);
genesis_custom_loop( wp_parse_args($query_args, $args) );
}
Well after clicking page 2 (of like 7), Im taken to a 404.
I think the issue is that there is only 1 post in the "news" category, and there are about 40 in "press-releases". So the pagination shows pages for all 40+ posts, but because there is only a single "news" post the second page doesnt actually exist? Since the url is /category/news Wordpress is creating the pagination based on the number of "news" posts?
How can I get pagination working here?