I have an if statement that checks for specific category ID's and displays HTML if the condition is true. I have many categories and would like to only apply the HTML to categories that do have a parent.
Is there a way to check if the category has a parent?
The current code is rather heavy, and requires manual intervention when a new child category is added - there must be an easier way.
<?php if(in_array($_category->getId(), array(117,179,121,123))): ?> <p>Display this text.</p> <?php else: ?> <p>Display this text instead.</p> <?php endif; ?>