Home Forums General Issues Help With Taxonomies Reply To: Help With Taxonomies

  • Hi @jeremybdavis,

    Thanks for the post.

    To show the attached product, you can have the following loop:

    $terms = get_field('attached_product');
    if( $terms ): ?>
    	<?php foreach( $terms as $term ): ?>
    		<h2><?php echo $term->name; ?></h2>
    	<?php endforeach; ?>
    <?php endif; ?>

    As for the posts in a particular taxonomy you will need to create a loop to get the posts like so:

    $args = array(
    	'post_type' => 'post',
    	'tax_query' => array(
    			'taxonomy' => 'attached_product',
    			'field'    => 'slug',
    			'terms'    => 'product',
    $query = new WP_Query( $args );