Skip Navigation

[Resolved] I want a main image and an image gallery. I want to hide the gallery when empty

This support ticket is created 5 years, 5 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 – 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: 

This topic contains 5 replies, has 2 voices.

Last updated by Shane 5 years, 5 months ago.

Assisted by: Shane.

Author
Posts
#1307895
Screenshot 2019-08-02 at 14.43.38.png
Screenshot 2019-08-02 at 14.47.03.png

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

#1308233

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

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

#1308663
Screenshot 2019-08-03 at 17.39.49.png
Screenshot 2019-08-03 at 17.40.19.png
Screenshot 2019-08-03 at 17.31.42.png
Screenshot 2019-08-03 at 17.31.58.png
Screenshot 2019-08-03 at 17.34.53.png

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.

#1309651

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

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

#1309871

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.

#1309909

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anike,

You could try using this plugin here below.
https://wordpress.org/plugins/fancybox-for-wordpress/

Thanks,
Shane