Home › Forums › Add-ons › Gallery Field › display first gallery picture on archive page › Reply To: display first gallery picture on archive page
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.
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’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.