Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Brady Vercher

    (@bradyvercher)

    Hi Evan,

    The tracks are currently stored as a custom field on the playlist. I’ve been waiting until the REST API is rolled into core before looking into making them CPTs.

    I’m not sure exactly what you’re needing, but your best is to retrieve all the tracks using get_cue_playlist_tracks() and grab the one you want out of that array.

    Cheers,
    Brady

    Thread Starter Evan Brammer

    (@ebrammer)

    Brady,

    Could you show me an example of what that might look like? For example, if I wanted to grab the third track in the playlist with an id of 435?

    Plugin Author Brady Vercher

    (@bradyvercher)

    Looks like the link in my previous comment doesn’t show up very well, but you’d just grab all the tracks, then reference the third one in that array:

    $tracks = get_cue_playlist_tracks( 435 );
    $third_track = $tracks[3];

    The $third_track variable will have an array of track properties in it, so if you wanted the url, you could reference it like this:

    $url = $third_track['audioUrl'];

    Thread Starter Evan Brammer

    (@ebrammer)

    See the link now – but your example is perfect. Thank you!

    Next question, and I imagine this would entail delving into the javascript, but how would I go about adding a download link for each track?

    Plugin Author Brady Vercher

    (@bradyvercher)

    You shouldn’t really need any JavaScript for that. If the download link is just the audio file URL, then you can copy the template to cue/playlist.php in your theme and update it to include your download link.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Enqueue a specific track in a playlist using php’ is closed to new replies.