I have a custom post type, called Exercises. I also have many categories within that custom post type. I use archive-exercises.php custom loop to display my main exercises page.
Question: How do I modify my archive-exercises.php so it will display only post from specific category?
I managed to get similar effect on my home page with regular posts:
<?php query_posts('cat=93&showposts='.get_option('posts_per_page')); ?>
Use the
pre_get_posts
action to modify any main query before it is sent to the database, this includes the case of your home page as well. Callingquery_posts
in the template runs a new query, overwriting the original- it’s a waste of resources and can produce unpredictable results, particularly with pagination.Just setup a new query restricted to your custom post type and your desired category/categories…