If thumbnail

On this page:



The if_thumbnail tag is a conditional tag and always used as an opening and closing pair, like this…

    …conditional statement…

The tag will execute the contained statements if the current image (from an images tag) has a thumbnail assigned to it. Must always be used in an image context.


This tag has no attributes.


Example 1: Only show a thumbnail if one exists

<txp:images author="neo" wraptag="figure" class="author-gallery">
        <txp:thumbnail />
        <txp:image_info wraptag="figcaption" />
    <txp:else />
        <p>No thumbnail</p>

For each image uploaded by author ‘neo’, display its thumbnail if it has one, or the text ‘No thumbnail’ if it doesn’t. Add a caption beneath the thumbnail using image_info.

Other tags used: images, else, image_info, thumbnail.


Version 4.3.0

Tag support added.

See something wrong in this document? Outdated info, a broken link, faulty code example, or whatever? Please open an issue and we’ll investigate.