Skip Navigation

[Resolved] 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 support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.
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.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Noman 7 years, 1 month ago.

Assisted by: Noman.

Author
Posts
#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: English (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

The forum ‘Types Community Support’ is closed to new topics and replies.