Skip Navigation

[Resolved] Conditional – Check if second image in gallery exists

This support ticket is created 3 years, 10 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)

This topic contains 1 reply, has 2 voices.

Last updated by Shane 3 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#2207909

Tell us what you are trying to do?
I set up a custom type and added the images element.
In the custom type template, I want to render some text when the gallery consits of more than one image.
I am using block editor to create the template.

Is there any documentation that you are following?

Is there a similar example that we can see?
hidden link
This custom type has more than one image attached to it, so in this case I would like to render some custom text.
The gallery uses simple grid lay-out, but I added some custom CSS to be able to enlarge the first image.

What is the link to your site?
hidden link

#2208019

Shane
Supporter

Languages: English (English )

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

Hi Dimitri,

Thank you for getting in touch.

You should be able to do it by modifying your blocks conditional in the advanced editor mode and using this below.

 NOT ( empty( '[types field='my-image' index='1'][/types]') ) 

Replace my-image with the slug of your image field.

Please let me know if this helps.
Thanks,
Shane