Skip Navigation

[Resolved] I want to show default image if image field is empty

This support ticket is created 5 years, 2 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#1333035

I have created a search using views. In the content block, I have a field called thumbnail. I need help in doing the following.
1) The thumbnail size should be 300*300. Though I have set the value, it exceeds.
hidden link
2) I want to output results on the conditional basis
i) If the thumbnail does not exist, I want to show an image from another field say Add photos field where photos may exist.
ii) If both fields are empty, I would like to show a default image.
Thank you for your support

#1333085

Hello,

Q1) The thumbnail size should be 300*300. Though I have set the value, it exceeds.
How do you setup the field "thumbnail"? Is it a custom image field?

If it is, you can follow our document to display the custom image field in specific size:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image
size:
custom image size | 'full' | 'large' | 'medium' | 'thumbnail'
width and height will be ignored if size is set.

Q2) I want to output results on the conditional basis

I suggest you follow our document to setup the [wpv-conditional] shortcode and display the image you want:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/