Home › Toolset Professional Support › [Resolved] I want a main image and an image gallery. I want to hide the gallery when empty
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 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Tagged: Views plugin
This topic contains 5 replies, has 2 voices.
Last updated by Shane 5 years, 5 months ago.
Assisted by: Shane.
Tell us what you are trying to do?
I want to have two image fields. A main image and an image gallery. I want the gallery to be hidden when it is an empty field on the front end. At the moment the image that I put in the main image field is showing repeatedly. Is there a way that I can fix this?
Is there any documentation that you are following?
Is there a similar example that we can see?
I have attached an image of what the page looks like when there is more than one image and what it looks like when there is only one. I'd like the second field to be hidden if there is only one image instead of being replicated if possible.
What is the link to your site?
hidden link
Hi Anike,
Thank you for contacting our support forum.
As you say both Gallery and the main image fields are 2 separate custom fields ? Could you let me know the shortcodes that you are using as well as send a screenshot the 2 fields on the backend ?
Thanks,
Shane
Hello,
In the toolset fields section there is only one option for image. To get the gallery I selected "Allow multiple instances of this field. " I've added the screenshot images of this.
I used elementor and toolset blocks to display the fields on the front end.
Hi Anika,
I suspect the issue here is because of the elementor dynamic custom field widget. Try adding the field directly to the page using the shortcode.
What will happen is if the field is empty it will automatically display no images. Alternatively you can look into our conditional shortcodes.
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/
Thanks,
Shane
Hello Shane,
Thank you. Can I ask, is it possible to display the images as a clickable link i.e. to click and see a larger image when using the shortcode? At the moment it is just embeded on the page or displayed as a url.
Hi Anike,
You could try using this plugin here below.
https://wordpress.org/plugins/fancybox-for-wordpress/
Thanks,
Shane