Adding Custom Post Type (CPT) is a routine matter these days, you can easily create custom post type using CPTUI plugin, but there are some things which are not supported out of the box.
WordPress does not support custom post types CPT in the archives for the default categories and tags listing for CPT. FOr CVPT to appear on categories and tags listing pages, you need to add the CPT to the query yourself.
You will add the following snippet to your theme’s functions.php file.
Add All CPTUI Post Types to the Archives for Category & Tags Listing
The following code snippet, checks a category or a tag and if we’re not suppressing filters. If that’s all true, then we fetch all CPTUI created post type CPT slugs, and merge it into an array with the default ‘post’ type. With that array merged, it is passed to the query parameters and WordPress includes them into query for all these custom post types.
Add this code in your theme functions.php or using Code Snippet plugin:
function pim_cptui_add_post_types_to_archives( $query ) { if ( is_admin() || ! $query->is_main_query() ) { return; } if ( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) { $cptui_post_types = cptui_get_post_type_slugs(); $query->set( 'post_type', array_merge( array( 'post' ), $cptui_post_types ) ); } } add_filter( 'pre_get_posts', 'pim_cptui_add_post_types_to_archives' );
And here is the gist:
Hope that helps!