Home › Forums › Add-ons › Gallery Field › display first gallery picture on archive page › Reply To: display first gallery picture on archive page
Hi @davelee
Yes, this is possible, however you will need to write some custom PHP to hook into the save function and then update the post’s featured thumbnail.
How many ‘first images’ are you showing? Just the one, or are there multiple posts?
The bad performance most likely comes from ACF having to return all the image data such as crop sizes.
You can get the root value of the gallery field by using the $format_value param like so:
$images = get_field('gallery', false, false);
This will give you an array of ID’s (much faster)
But you will then need to modify your code to load the image src / alt manually. You can find examples of this on the image field docs page.
Good luck
Thanks
E
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.