Adding Categories across posts, and custom post types

By default, only post_type post is shown on category pages. To enable your custom post types, you could hook pre_get_posts, check if it’s a category page, and if so add your post types: function wpse_category_set_post_types( $query ){ if( $query->is_category() && $query->is_main_query() ){ $query->set( ‘post_type’, array( ‘post’, ‘work’, ‘services’ ) ); } } add_action( ‘pre_get_posts’, ‘wpse_category_set_post_types’ … Read more

How to check if last uri segment is a custom post type or taxonomy term?

To see how we can make this work, have a read through the Query Overview Codex page, particularly the What Plugins can Modify section: Modify the query specification, after variable values are saved (request filter or parse_request action; if you want to use conditional tag tests, use the parse_query or pre_get_posts action, as these run … Read more

Using Custom Templates for Custom Post Types for the Genesis Theme Framework?

Turns out I was wrong, Genesis does support using the page_posttype.php method of creating a custom template. It turned out to be very simple. Here’s the contents of my page_members.php file (located in the child theme folder): <?php /* Template Name: Members */ remove_action(‘genesis_loop’, ‘genesis_do_loop’); add_action(‘genesis_loop’, ‘custom_loop’); function custom_loop() { global $paged; $args = array(‘post_type’ … Read more