Skip Navigation

[Gelöst] Random Image from Folder

This support ticket is created vor 6 Jahre, 5 Monate. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 2 Antworten, has 2 Stimmen.

Last updated by Chris vor 6 Jahre, 5 Monate.

Assisted by: Luo Yang.

Author
Artikel
#594071

Tell us what you are trying to do?
So I have a "thumbnail" image field for a CPT. If the user doesn't add an image, the thumbnail will be blank. What I am looking to do is to say If the Thumbnail is blank, then grab a random image from .../my-folder/ - is there a way to do this? Maybe a shortcode or something? Or is this built-in?

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#594216

Dear Chris,

There isn't such a built-in feature within Toolset plugin, you can create a custom shortcode for it, for example:
1) Use shortcode [wpv-conditional] to check if the "thumbnail" image field is empty,
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
then display below shortcode
2) Create shortcode to output a random image from .../my-folder/
https://codex.wordpress.org/Function_Reference/add_shortcode

#594545

Perfect. Thanks.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.