Skip Navigation

[Fermé] show only 1 image from multiple image post field

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Marqué : ,

This topic contains 1 réponse, has 2 voix.

Last updated by Noman Il y a 3 années et 12 mois.

Assigned support staff: Noman.

Auteur
Publications
#582290

Hi
under image custom post field, i have added a few images under this 1 post.

when creating a view,

[types field='image'][/types]

the result display all the photos, but i only want to display one of the photos.

how can I do that?

Thank you

#582313

Noman
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Kennethy,

Thank you for contacting Toolset support. You can use wpv-for-each shortcode in this case:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-for-each

- To show only very first image from the Repeating image field, you would use shortcode like this:

[wpv-for-each field="wpcf-image" end="1"]
[types field='image'][/types]
[/wpv-for-each]

- To show a specific image from the Repeating image field (e.g. image #3), you would use shortcode like this:

[wpv-for-each field="wpcf-image" start="3" end="3"]
[types field='image'][/types]
[/wpv-for-each]

I have tested and the above works well for me. Please try it and let me know how it works.
Thank you

Le sujet ‘[Fermé] show only 1 image from multiple image post field’ est fermé à de nouvelles réponses.