php - Advanced Custom Fields Repeater inside product category (woocommerce) -
i using acf 5. have set repeater on product categories.
i'm struggling how output information. inside acrhive-product loop , updating following template contains content gets outputting:
<?php while ( have_posts() ) : the_post(); ?> <?php wc_get_template_part( 'content', 'product_cat' ); ?> <?php endwhile; // end of loop. ?>
in content-product_cat.php have following each loop repeater. basic information shows, title, woocommerce category image etc. repeater added categories can't show.
<?php $terms = get_field('attributes', 'product_cat_'.$term->term_id); if($terms): ?> <ul> <?php foreach( $terms $term ): ?> <li> <?php the_sub_field('attribute'); ?> </li> <?php endforeach; ?> </ul> <?php endif; ?>
any thoughts appreciated
printed out args first:
<?php print_r($category);?>
then used output produce following:
<?php $cat_id = $category->term_id; //used below acf categories! ?> <?php // $cat_id = $category->term_id; $terms_features = get_field('features', 'product_cat_'.$cat_id); if($terms_features): // print_r($terms_features); ?> <ul> <?php foreach( $terms_features $terms_feature ): // print_r($term); ?> <?php $image_icon = $terms_feature['icon']; $image_icon_show = $image_icon[sizes][large]; // print_r($image_feature); ?> <li> <img src="<?php echo $image_icon_show;?>" /> <?php echo $terms_feature['description'];?> </li> <?php endforeach; ?> </ul> <?php endif; ?>
Comments
Post a Comment