Written by: Aleš SýkoraThe Author of Toolset.wiki. Big fan of Toolset plugins and WordPress. More info
I am big fan of WordPress and Toolset plugins. I have done many projects based on WordPress. I also have experience with online marketing, PPC advertising and SEO. I live in Czech Budweis – the town of Budweiser Budvar breverage in the south of the Czech Republic – the heart of Europe.
I love skateboarding, snowboarding, frisbee, fitness, healthy lifestyle, tattoos, mountain biking and other sports. I enjoy having time with friends with good beer and good music.
Display only first image from multi value field in toolset
Last Update: 22. 07. 2020 , Category:
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:
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.
Support Us via our Affiliate link!
What to do next?
Looking for a tutorial?
Help other users – Add your snippet!