Categories list loop – add separator every 3 categories [closed]
<?php $args=array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ) $count=1; // A $count variable ?> <?php foreach (get_categories( $args ) as $cat) : if($count%3==0) // This condition will be true for 3,6,9,12………. { //Your Code — } $count++ // Increment $count variable ?> <h3><a href=”https://wordpress.stackexchange.com/questions/246349/<?php echo get_category_link($cat->term_id); ?>”><?php echo $cat->cat_name; ?></a></h3> <a href=”https://wordpress.stackexchange.com/questions/246349/<?php echo get_category_link($cat->term_id); … Read more