I am currently using ACF 5. I have set up a repeater on the product categories.
I'm currently struggling with how to get it to output the information. I am inside the acrhive-product loop and I am updating the following template that contains the content that gets outputting:
<?php while ( have_posts() ) : the_post(); ?>
<?php wc_get_template_part( 'content', 'product_cat' ); ?>
<?php endwhile; // end of the loop. ?>
In content-product_cat.php I have the following for each loop for the repeater. All the basic information already shows, the title, the woocommerce category image etc. Its the repeater I added to the categories themselves I can't get to show.
<?php
$terms = get_field('attributes', 'product_cat_'.$term->term_id);
if($terms): ?>
<ul>
<?php foreach( $terms as $term ): ?>
<li>
<?php the_sub_field('attribute'); ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
Any thoughts would be greatly appreciated
WP_DEBUG
enabled? You might want to. That might tell you, at least, if you have undefined objects/variables. How are you defining$term->term_id
? I'd start there because withoutterm
you'll never even get into theforeach()
loop. After that, I don't know enough about ACF. – helgatheviking