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

Media Library Images in Oxygen’s Repeater

Sridhar Katakam

Repeaters in Oxygen can only output objects of type posts out of the box.

Gagan Goraya shared a snippet here that enables us to display objects of any type with custom code.

This members-only tutorial provides the steps to use the posts_results filter to feed media objects (images from the Media Library) to a Repeater. Inside the Repeater's Div, we shall show the image thumbnail linking to its full version for all the items.

While this is not going to have any immediate benefit over outputting the images using a Gallery component, the application still has its uses in other situations. Ex.: displaying image's meta data like caption text inside a lightbox when the image thumb is clicked. We will cover this in another tutorial.

Step 1

Let us register a couple of custom functions that return the URLs of the images in a specified size and the full size.

Snippet title: Attachment image thumbnail URL

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.