Skip Navigation

[Résolu] I want to show default image if image field is empty

This support ticket is created Il y a 5 années et 2 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Luo Yang Il y a 5 années et 2 mois.

Assisté par: Luo Yang.

Auteur
Publications
#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.
lien caché
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/