Some items have associated thumbnail images and some do not. item_has_thumbnail
can be used to display an item differently based on whether or not it has a thumbnail. It will return true or false according to whether the item has an associated thumbnail.
Usage
<?php if (item_has_thumbnail()): ?> <!-- do stuff --> <?php endif; ?>
Arguments
- Item
$item
{{#if - null | (optional)}}
- Item to check. By default, the current item will be used.
- {{#if: null | Default:
null
}}
Example
To wrap the thumbnail image in a div only if the item has an associated thumbnail, do the following:
<?php if (item_has_thumbnail()): ?> <div class="item-img"> <?php echo link_to_item(item_square_thumbnail(array('alt'=>item('Dublin Core', 'Title')))); ?> </div> <?php endif; ?>