Skip Navigation

[Resolved] Set default image to content template loop

This support ticket is created 5 years, 5 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 5 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#1259261
Screenshot 2019-06-05 at 10.22.28.png

Tell us what you are trying to do?
I have a apartment listing page. Some apartments do have featured image which is shown in listing and some of the do not. Is there a way to add default image if there is no image? Currently I have a background color set to it, but my client wants to add an image.

Pricture it attachment.

#1259345

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - you can use the view's conditional shortcode [wpv-conditional] to display the conditional output.

For example - to check the featured image is empty:

[wpv-conditional if="( '[wpv-post-featured-image output="url"]' eq '' )"]
<img src="default-img-path-" class="add-class" />
[/wpv-conditional]

Where:
- You should replace the default image path and class attribute where required.

More info:
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/