Skip Navigation

[Resolved] Random Image from Folder

This support ticket is created 7 years 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 2 replies, has 2 voices.

Last updated by Chris 7 years ago.

Assisted by: Luo Yang.

Author
Posts
#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.