12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Nov 28, 2022

Accessing Image Sub Field’s Alt Inside Oxygen and ACF Repeater

Sridhar Katakam

Scenario: "WP Builders" ACF Pro Repeater with a "Image" (image-type) sub field.

In the Oxygen Builder, these images can be output by setting the Oxygen Repeater component to query the ACF Repeater

and setting Image URL to Post → Repeater Field → Image (the name of the sub field).

where the image field's return format has been set to Image URL.

So far so good. Now how do we set all the images' corresponding alt text to also be output in the HTML?

This isn't natively possible in Oxygen but we can work around this and in this members-only tutorial shows we will see how.

Sample output after implementing this tutorial:

This method can be also used to pull and use/show other image meta-data like titles, captions and descriptions if needed.

Step 1

Add the following in a code snippets plugin or a custom functionality plugin:

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $599 one-time).

Already a member? Log in below or here.