illustration of computer screen with two windows floating on top of a media player

dev corner: ACF custom field for flexible media content

October 5, 2018

written by

Everyone knows that video is the ‘thing’ now for creating an immersive brand experience. That means clients just expect it to be interchangeable with images on their websites. But we know it’s not a mix and match so how do we best make that work from the back end of things? UX isn’t just for users, but for admins too. Here’s the solution our lead developer came up with for our WordPress builds.  BTW at the end you can add it as a plug in as well, because we think it’s awesome to share cool things.

In technical terms, our issue was a recurring need for media interface elements to support both images and video, and accompanying configurable settings.

the old way.

How we used to do it might look something like this:

This was far from ideal! Four fields needed everywhere media was to be displayed became unwieldy.

the new hotness.

Our new solution looks like this:

Our custom field allows video and images like a File field, but also allows relevant meta-data for how you want to display and annotate your media. It can also be easily expanded to meet our needs without requiring additional fields to be added all over the site.

The data is stored as JSON so you can use it however is required for the UI component.

Get it now on the WordPress plugin repository.