Counter in loop in foreach
EDIT Ok so after better understanding your issue, I would not use a counter but a true/false flag that we switch when it’s been used. Try this code. $cats = array(‘batiments-delevage’, ‘logements-bovin’, ‘stockages-deffluents’, ‘soins-et-hygiene’); $exclude_posts = array(); $active = true; foreach( $cats as $cat ) : // build query argument $query_args = array( ‘category_name’ => … Read more