WORDPRESS - Oxygen - toolset

Display only first image from multi value field in toolset

Author: Aleš Sýkora, 22. 7. 2020

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.

Before:

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

After:

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

And thats it.