php - Within a product loop, get posts associated with custom taxonomy terms and current product -


i'm working woocommerce in wordpress. i've got 3 products (called "kits") , each kit contains several items. "items" custom post type linked each kit via relationship field. each item has custom taxonomy attached ("departments"). departments have no direct link products (or "kits"), except via items.

when display products, want them show <ul> loops through each term found in department. within <li>, have nested <ul> lists each item found in current department , in current product.

i've got loop that's working display items associated each product:

<a href="#details<?php the_id(); ?>" class="details button" data-id = "<?php the_id() ?>">details</a> <div class="items" id="details<?php the_id(); ?>">       <?php  $items = get_field('kit_items');?>     <?php if( $items ): ?>         <ul>         <?php foreach( $items $item ): ?>             <?php $ident = $item->id ?>             <li>                 <a href="#overlay<?php echo $ident ?>" class="item item<?php echo $ident ?>" data-id ="<?php echo $ident ?>">                     <?php echo get_the_title( $item->id ); ?>                 </a>             </li>         <?php endforeach; ?>         </ul>     <?php endif; ?> </div> 

but i'm not sure how query custom taxonomy, print out terms , print items associated department , current product.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -