I have created a new CPT called ‘Properties’ and have added a new taxonomy called ‘Project Categories’ which then have subcats called ‘Current_projects’ and ‘Past_projects’. I want to have a button on the archive-property.php page which when clicked shows either one or the other category’s related posts.
I used CPT UI to build both the taxonomy and the custom post.
in the archive-property.php, I have the following code:
<?php if( have_posts() ) : ?>
<div id=”post-list” class=”columns property-grid”>
<?php while( have_posts() ) : the_post(); ?>
<?php get_template_part( ‘partials/content’ , ‘property’ ); ?>
<?php endwhile; // while has_post(); ?>
<?php the_posts_pagination(); ?>
<?php endif; // if has_post() ?>
Inside the template partial it just calls the article information (title, excerpt, etc).
This pulls all my postings however in that Custom Post type. How do I have it so that it only pulls posts with ‘current_projects’? I plan to have a div/tab system that filters between the two.
Read more here:: Show Custom Post Type based on Category on Archive Page