So i did finally solve it. With a counter inside the loop. Here’s part of the code:
$theCount = 0; //this gets reset with each new category
if (have_posts()) : ?>
<?php $theCount = 0; ?>
<?php while (have_posts()) : the_post(); ?>
<?php if ( in_category($cat->name) ) { ?>
<?php if ($theCount == 0) echo “<h1>”.$cat->name.”</h1>”; ?>
<?php $theCount++; ?>
Worked like a charm.
@bcworkz Thanks for the reply.
I think get_terms() is close but my situation is this: I may have a location that has three items and a location that has two items like so…
I need to hide a Menu Item Type if it does not have any posts for that particular location. So location 1 could have pizza, burgers and beers and location 2 may only have pizza and beers.
I need to hide the burgers title when I’m listing items for location 2.