Tell us what you are trying to do?
I am trying to convert existing data on my site into something that can be easily managed using Views.
Is there any documentation that you are following?
No.
Is there a similar example that we can see?
Here is a sample "chart."
hidden link
I am trying to move all the data from these manually created posts into Toolset Types. I created the post type "Bent*Spun Charts" as a start, but my head is spinning on what I need to do next. I reckon I need to create these other CPTs:
Track Name
Artist
Collaborator
Collaboration Type
Parent Album
Current Chart Position
Last Week's Chart Position
Etc...
A song can appear on multiple charts, which means it can have multiple current and last week positions.
I'm stuck on what to do next. Is it even possible - what I'm trying to do? Any pointers/suggestions would be much appreciated.
What is the link to your site?
hidden link
If you create a "Chart" CPT, then link Tracks and Charts in a M2M relationship, you can apply custom fields to the relationship that represent the current week and last week positions (no CPTs necessary for positions). This doesn't give you the ability to track these positions over time, it's just a way to show the current and last week positions right now. For each Chart, these values can be different and you can modify them each week as the new chart positions are determined. Similarly, a Collaboration Type might just be a custom field on a relationship between two Artists. Collaborator CPT might not be required at all, since a Collaborator is just...another Artist, right?
One problem you'll have to overcome is that a View of Tracks cannot be sorted or filtered by a custom field applied to another post type or to the relationship, so listing Tracks directly in order of chart position isn't possible in the scenario I described. If your M2M relationship uses an intermediary post type, then you can make that intermediary post type visible in wp-admin and create a View of that intermediary post type. Then you can sort by one of those position fields. You will need to be access related posts to display information about the track or album or chart for each result. That can sometimes be accomplished with a simple shortcode attribute, other times it can be more complicated. Depends on the organization of your post types and custom fields.
That's actually the simplest approach in a best-case scenario to display what I see in your example. It gets more complicated if you want to maintain a history of chart positions over time for each track, so you can go back a few months and see the chart positions. That would require a more complex system of custom fields or a Repeating Field Group. If you need to be able to do custom searches based on these custom field values, then it becomes even more complex and there are lots of nuances to consider, based on the site requirements. Hard for me to say based on one mockup, but I'm glad to discuss if you have other questions.
Thanks Christian.
Yes, ideally, it would be great if one can look up and see the entire chart history of any specific track. Right now, it's impossible to see this history the way I have things set up. How does the repeating field group work?
My initial thought was to create a Repeating Field Group that has at least these fields:
- Current position
- Chart Date
This RFG will be managed on the Intermediary post type. Each time a Chart is updated, you will add a new row of RFGs to the intermediary post connecting a ranked Track to the Chart.
To show a history of Track ranks, you create a View of RFGs filtered by post relationship, linked to the Intermediary post.
Since you can't sort or filter a View of intermediary posts by fields in an RFG assigned to that post, you may have to maintain duplicate position info for the current chart status in the intermediary post, as well as in the RFG.
I'll backburner this one for now. I still cannot wrap my head around it. Probably easy for an expert to do.