Textpattern | PHP Cross Reference | Content Management Systems |
1 <!-- set up a variable to check whether an image also has a caption associated with it... --> 2 <txp:variable name="caption" value='<txp:image_info />' /> 3 4 <!-- ...now use that image caption and wrap img inside a figure with figcaption tags, otherwise just use a plain img tag --> 5 <txp:if_variable name="caption" value=""> 6 7 <p itemprop="image" itemscope itemtype="https://schema.org/ImageObject"> 8 <img loading="lazy" itemprop="url contentUrl" src="<txp:image_url link='0' />" alt="<txp:image_info type='alt' />"> 9 <meta itemprop="width" content="<txp:image_info type="w" />"> 10 <meta itemprop="height" content="<txp:image_info type="h" />"> 11 </p> 12 13 <txp:else /> 14 15 <figure itemprop="image" itemscope itemtype="https://schema.org/ImageObject"> 16 17 <img loading="lazy" itemprop="url contentUrl" src="<txp:image_url link='0' />" alt="<txp:image_info type='alt' />"> 18 <meta itemprop="width" content="<txp:image_info type="w" />"> 19 <meta itemprop="height" content="<txp:image_info type="h" />"> 20 21 <!-- you do not need to specify the attribute type="caption" as that is the default setting for <txp:image_info /> tag --> 22 <figcaption itemprop="caption"> 23 <txp:image_info /> 24 </figcaption> 25 26 </figure> 27 28 </txp:if_variable>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title