The posts on our music blog usually include multiple tracks of music.
I want to have each individual track be its own entity–a custom post type called “track”–which I want to be able to insert freely into a post where I wish using a shortcode.
The image below explains pretty well what I am looking to do.
(Link to the page that I took the screenshot from: http://iloveomfg.com/210/don-rimini-whatever-kaptain-cadillac-remix/ )
I want to create a shortcode, [track], which echoes the entire contents of the ‘track’ custom post type which id is specified. For example, if the track id is 34, the shortcode to display it within the post would be: [track id=34] or [track id=”34″].
I have taken a look at all the posts related to this topic on this site, and have tried a few of the solutions, but to no avail, so I decided to go ahead and ask for my problem specifically. Can you tell me exactly what I need to do to achieve this?
Let me know if you need me to clarify anything.
I would suggest creating a new custom taxonomy for relations between a post and its “tracks” or grouping of track posts if you’d like
that way you can easily create a shortcode that will query all the needed tracks at once using a shortcode instead of calling your shortcode over and over and to order them you can create a custom field in track so in your query you can order by that field so it would be something like this (this assumes that you have a custom taxonomy named “post_tracks” and that all of the posts tracks were added to the same term of that taxonomy, also that you have a custom field to order you tracks named “in_order” :
with this you can simple call your shortcode like this:
or just get your single track on at a time:
You have two issues here I think.
1 – Making a short code. This Nettuts tutorial is excellent at stepping through each of the steps needed. (though you don’t need the second half about adding a tinymce button).
2 – A way of storing track details. I am guessing you could you use a new post for each track with custom meta with the link to the audio file and any other details you want. Then the track=ID would refer to the ID of the post and you would use the shortcode to grab the ID and then hunt down the post with that ID and then include the meta of that post.
Hope that helps.