This Premium tutorial provides the steps to set an image specified by its index from a ACF Pro Gallery-type field for Pages as the background of the hero section for Pages in Oxygen.
ACF Field Group:
Field being populated on a Page:
After implementing the tutorial, 2rd image (Index = 1) as Hero section background on the Front end:
3rd image (Index = 2) as Hero section background on the Front end:
Step 1
Add a new field group for your post type.
Ex.: "Page Fields" for Pages.
Add a Gallery-type of field.
Sample field name: hero_background
Leave the Return Format the default 'Image Array'.
Step 2
Edit your posts (Pages, in this example) and populate the field for each.
Step 3
Create a custom function named say, "Get a image URL from ACF Gallery by index" having this code using a code snippets plugin: