Display Pod CPTs that have a taxonomy term
-
Using Pods, I’ve created a Custom Post Type (CPT) with name “resource” and a taxonomy w/ name “region” and associated that taxonomy with that CPT. I’ve created a custom template in my theme to display a list of Resources; this works fine. But when I try to display only Resources with a particular “Regions” taxonomy term, I still get a list of ALL Resources, rather than one that has been filtered by the taxonomy term. Can anyone spot what’s wrong with my code, or suggest another method?
I’ve tried this (from my template file):
<?php $resource = pods('resource'); $resource->find('resource_resource_name ASC'); ?> <?php while ( $resource->fetch() ) : ?> <?php if ( has_term( 'someregion','region' ) ) : ?> <?php // set our variables // (I set my variables here, to retrieve pieces of the CPT and make them into variables.) ?> <div class="resource" id="resource-<?php echo str_replace(" ","-",$resource_resource_name); ?>"> <?php // My markup for each item, with variables inserted, goes here. ?> </div> <!-- /.resource --> <?php endif; ?> <?php endwhile; ?>
Any help appreciated! I’ve been searching for answers for a full day and nothing I’ve tried is working!!
Thanks.
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘Display Pod CPTs that have a taxonomy term’ is closed to new replies.