I am developing a theme that is compatible multiple post formats (video, audio, gallery, status, quote, etc.)

From the perspective of a theme developer, what is the best practice way of handling custom fields in these different post formats?

So say for example, you have a theme that supports video post formats. The only difference between a standard post and a video post format is that there is an embedded video instead of an image at the top of the post.

So obviously, you have to create a custom field for the user to store their embed code, so it can be placed at the top. But what if the user wants to change their theme? Is this going to be much of a hassle for them? From my understanding, custom fields are not theme specific so the data in them can be transferred from one theme to another, right? So is it a case of them having to dive into the code and change variable names or is there an easier way for someone who is not code-savvy?

The main thing I am interested in is minimising the hassle of my end user if they decide to change their theme. So that they don't lose data like video embed codes and have to go through their entire blog to fix posts.

Is there a specific way that is best practice to store this type of data? or is it a case of being the users problem if they decide to change themes?

Apologies if this seems like a silly or obvious question, but I have seen some different approaches to this. The divi theme (by Elegant Themes) for example, just automatically takes the first video embed/ gallery/ audio embed in the post and places it at the top in the featured section, removing the need to store data in any custom fields. This seems easier from the users perspective but is much harder to implement into the theme.

I have also seen themes that have used the meta-box plugin for this. Is this something that is recommended?

Thanks very much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.