/ Published in: PHP
Use WP_Query to query a custom taxonomy, using the tax_query parameter.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // Example query to select all posts belonging to a custom taxonomy. 'taxonomy' => 'TAXONOMY_NAME', 'field' => 'slug', 'terms' => 'TAXONOMY_SLUG' ) ) ); $the_query = new WP_Query( $args ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; // Reset Post Data wp_reset_postdata(); ?>