Skip Navigation

[Resolved] Conditional display of featured image

This support ticket is created 6 years, 1 month 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 Yannis Sintos 6 years, 1 month ago.

Author
Posts
#1126548

I am displaying a list of the website's posts in the homepage of my website.
What i am trying to do is to show the featured image of a post if it exists.
The code i use in the output is the following, but it doesn't seem to work.

[wpv-conditional if="( NOT(empty($(wpv-post-featured-image))) )"]
<div class="row">
<div class="col-sm-3">[wpv-post-featured-image]</div>
<div class="col-sm-9">
<h4>[wpv-post-link]</h4>
<p>[wpv-post-date format="j F Y - H:i"]</p>
[wpv-post-excerpt]
</div>
</div>
[/wpv-conditional]
[wpv-conditional if="( empty($(wpv-post-featured-image)) )"]
<h4>[wpv-post-link]</h4>
<p>[wpv-post-date format="j F Y - H:i"]</p>
[wpv-post-excerpt]
[/wpv-conditional]
<hr>

#1126813

We have a DOC here that elaborates on the subject:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/#checking-if-a-post-has-a-featured-image

You would have to check upon "_thumbnail_id", instead of "wpv-post-featured-image".

#1127061

My issue is resolved now. Thank you!