I would like to get all the posts under a category (custom post type ui category) into a different template other than archive.php or category.php.
I tried normal way of getting the posts using category id, but it returns empty array. Please help.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
Worked perfectly for me!! Code will bring the posts(under CPT UI) to any page template.
<?php $loop = new WP_Query( array( 'post_type' => 'specialoffers', 'cat' => '12', // Whatever the category ID is for your aerial category 'posts_per_page' => 10, 'orderby' => 'date', // Purely optional - just for some ordering 'order' => 'DESC' // Ditto ) ); while ( $loop->have_posts() ) : $loop->the_post(); ?>
custom post type ui category
It sounds like you might be referring to a custom taxonomy that you created with the "Custom Post Type UI" plugin. If that's the case, then you'll need to use a taxonomy template:
tag.php are only used for the built-in "category" and "tag" taxonomies.