item_has_tags()
checks whether an item has any tags.
Usage
<?php if(item_has_tags()): ?> <!-- ... --> <?php endif; ?>
Arguments
- Item
$item
{{#if - null | (optional)}}
- Item to check. By default, the current item will be used.
- {{#if: null | Default:
null
}}
Example
The following code prints a list of all tags for an item. It uses item_has_tags()
to avoid printing the "Tags" header if there are no tags for an item.
<?php if (item_has_tags()): ?> <div class="tags" class="element"> <h3>Tags:</h3> <div class="element-text"><?php echo item_tags_as_string(); ?></div> </div> <?php endif;?>