Aleš Sýkora wrote

Display only first image from multi value field in toolset

22. 7. 2020 in

I am using a custom field called “product images” where I upload images for my custom post type Coffee machines. When I want to show the image in the archive then, I just want to display the first Image. Not all of them. What happen is that toolset field automatically display all images from the multi value field like this:

Backend image field has Two images inside.
Before: Toolset displays All images used in multi value image field.
After: Toolset display only first image from the field

What you need to do is add Index=”0″ to the field parameters. The index is zero-based, so the first item will be 0, the second item will be 1, the third item will be 2, and so on.


[types field='obrazek-produktu' title='%%TITLE%%' alt='%%ALT%%' align='center' size='custom' height='180' resize='proportional' separator=', '][/types]


[types field='obrazek-produktu' index="0" title='%%TITLE%%' alt='%%ALT%%' align='center' size='custom' height='180' resize='proportional' separator=', '][/types]

And thats it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More from category
Aleš Sýkora wrote
Tracking events with Google Tag manager & WordPress
23. 8. 2019 in
Add numbers to your content with Google Tag Manager & Google Analytics Events.
Read More
Aleš Sýkora wrote
Trigger js event after ajax finished
2. 7. 2019 in
There's a way to trigger a javascript callback after ajax event. The way how to do that is easy.
Read More
Aleš Sýkora wrote
Emoji deleted from ACF field after saving
2. 4. 2021 in
So you have a ACF text field and you are trying to insert emoji to it. For example as a category icon. You add the field, add the emoji, use the PHP code to display the field. And emoji is missing. After that you found that every time you save the page, emoji dissapear from […]
Read More
magnifiercross linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram