Anyone got any ideas why this counter will not count in the id for the h4 tag?
<?php
if ( $loop->have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post();
//Do something if a specific array value exists within a post
$clauses = wp_get_post_terms($post->ID, $section->taxonomy, array("fields" => "all"));
$counter3 = 0;
foreach($clauses as $clause) { ?>
<h4 class="<?=($clause->parent == 0) ? 'd-none' : '' ?>" id="<?php echo $counter3; ?>"><?php echo $clause->name; ?></h4>
<a class="d-block" href="<?php echo the_permalink();?>"><?php echo the_title(); ?></a>
<?php $counter3++; }?>
<?php endwhile; endif; wp_reset_query(); ?>
Any help appreciated.
CHRIS
` tag and increment the id by 1 each time.
– Chris Davies Oct 30 '17 at 05:30