I'm building a child theme and have set up an additional custom post type ('blogs').
I need regular and custom posts to be returned on the archive page. The have_posts function only returns regular posts.
How do I amend the have_posts function to include custom posts?
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); endwhile; wp_reset_postdata(); endif; ?>
I did try this approach:
<?php $args = array( 'post_type' => array( 'post', 'blogs' ), ); $myQuery = new WP_Query($args); if ($myQuery->have_posts() ) : while ($myQuery->have_posts() ) : $myQuery->the_post(); endwhile; wp_reset_postdata(); endif; ?>
Which returned posts and 'blogs' - but from ALL categories, instead of posts and 'blogs' with the relevant category.
Any advice would be much appreciated as I'm new to Wordpress dev.