Under most circumstances this would be an easy answer, but I have a slightly trickier segment I am working with.
The following code displays the category names if they are selected in the entry:
<div class="project-brief open-close">
<h3>Results Type</h3>
<div>
<div class="project-brief">
<ul class="brief-list">
<?php $parents= array(); ?>
{categories show_group="5"}
<?php $parent_id = '{parent_id}'; if(!$parent_id) {$parents ['{category_id}'] = '{category_name}';} ?>
{/categories}
<?php foreach ($parents as $key => $parent) { ?>
<li><a href="/projects?category=<?php echo $key; ?>"><?php echo $parent; ?></a>
<ul class="brief-list-childs">
{categories show_group="5"}
{if parent_id == <?php echo $key; ?>}<li><a href="/projects?category={category_id}">{category_name}</a></li>{/if}
{/categories}
</ul>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
However, the client wants to hide the entire section if none are selected in the entry.
I want to wrap the entire div in a conditional that checks to see if any of the categories are checked and display it only if it is not empty.
I would say it like this, but I can't seem to get the conditional right. Any guidance will be appreciated.
{If category count > 1}
... display the content
{/if}