Go to main content

If thumbnail




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 of its own. It accepts only the global attributes .


Example 1: Only show a thumbnail if one exists

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

For each image uploaded by author ‘donald’, 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.

If you notice any kind of problem with this page's construction or content (outdated information, typos, broken links, or whatever), open an issue to have it sorted. Or have a go at it yourself. :)