In the WPDevDesign facebook group, a member asked about having a section that uses a random image from a pool of images as a background. In this premium tutorial we'll walkthrough how to do it in Oxygen
We'll go through the following steps;
The gallery field works well for this as it's an intuitive way the client can add a number of images to be randomly selected from.
We'll name our gallery field 'hero-background', apply it to pages, and be sure the 'return format' setting is set to 'image array'.
We'll need to create a custom function that takes the array of images from the gallery and returns the URL of one of those images, chosen randomly.
In our code snippets, we can create a function with this code;
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $399 one-time).
Already a member? Log in below or here.
Enter your email address to subscribe to this blog and receive notifications of new tutorials by email.
Join 385 other subscribers
Please log in again.
The login page will open in a new tab. After logging in you can close it and return to this page.