0
votes

I have a custom post type FAQ and custom taxonomy Category.

I want to loop through the taxonomy Category, take its values, and then loop through custom post type FAQ and grab all the posts that have the same taxonomy values.

Can anyone shed some light on this ?

Can't find any decent samples online that are trying to do what I want, only the opposite.

Cheers, Dave

2
Figured it out :) Would just like to share the answer :) $taxonomy_loop = new WP_Query( array( 'taxonomy_name_here' => $taxonomy_value ) ); Where $taxonomy_value represents the value you are searching for. Regards, Dave - Dave O'Dwyer

2 Answers

0
votes

You can do it on this way also

<?php query_posts(array('post_type' => 'post type name', 'Taxonomy slug' => $term->slug ) ); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>

Get from http://techsloution4u.com/code-snippet/how-to-create-custom-taxonomy-loop.html

0
votes

Figured it out :) Would just like to share the answer :)

$taxonomy_loop = new WP_Query( array( 'taxonomy_name_here' => $taxonomy_value ) );

Where $taxonomy_value represents the value you are searching for. Regards, Dave