I have a Roster page which contains two sections. The first section contains the artist with their pictures, short bios, and website links; and the second section contains the combined videos of every artist in the roster.
Similar to this:
Normally, I’d create two separate post types; one for ‘artist’ and another for ‘artist videos’ but I was wondering if there was a way I can somehow combine the two? So in the admin panel, it would look something like this:
If possible, how would I go about doing this? Or am I over-thinking this (as I often do) and is there an easier way?
It would take some custom coding, but there is a way to keep both custom post types and link the artist and video post types together. It involves using the post_parent property of a post to make them hierarchical without combining the two.
I’m currently using the following code to attach one post type to another:
Add this to a metabox on your video edit pages, passing your artist type as the parent type. It’ll create a dropdown box that will list all the artists you have. Just select one and update and that video now sees the artist you selected as a parent. After that, you can create a custom template to pull all the videos for any particular artist.
Don’t quite know if i get you right, but you could make one hierarchical post type and then diversify either by level in the hierarchy or by some meta value you add.
Edit: To rephrase, you simply create an ‘ArtistOrVideo’ post type, so to speak, and make it hierarchical. It represents both. The first level (post_parent=0) you always treat as an Artist. The second level (post_parent points to a post with post_parent = 0) you always treat as a video. You can then react in your metabox-callback to that as well and create the Artist metabox for post_parent=0 posts and the video metabox for the others. I’m pretty sure you can take this through the whole application.
However, the canonical alternative at hand is: Can’t you create an ‘Artists’ Taxonomy instead?