Skip Navigation

[Resolved] Conditional Checking If A Post Has A Featured Image Caption text?

This support ticket is created 4 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by bobA-2 4 years, 9 months ago.

Author
Posts
#1565839

Is it possible to do a wpv-conditional specific Checking If A Post Has A Featured Image Caption text in a Content template?

I would like to display the code below only if Caption exist

<figcaption class="single-caption-text">
<span class="fa fa-camera" aria-hidden="true"></span> [wpv-post-featured-image size='full' output='caption']
</figcaption>

#1566417

The easiest approach here is to insert [wpv-post-featured-image size='full' output='caption'] and check what it outputs both for a post with and a post without Featured Image Caption.

Then, use the HTML Conditional to compare to that value.

Something like

[wpv-conditional if="( '[wpv-post-featured-image size='full' output='caption']' eq '' )"]
  HAS NO CAPTION
[/wpv-conditional]
#1566481

My issue is resolved now. Thank you!