I'm trying to add a buy button beside each song that links to itunes. Unfortunately, I'm new to jPlayer and have absolutely no idea where to start. The jPlayer already exists in the wordpress theme I bought, everything has been setup nicely and am really only needing this last additional feature.
Everything should look like this: http://i.stack.imgur.com/dwCGr.png
As of now, I've inspected the javascript file and have successfully added a link beside each of the song in the playlist. However, the links are static and I need them to be linked to a field from custom post type in wordpress. The codes are below:
//The added buy on itunes link is below with a class .playlist-item-buy
_createListItem: function(b) {
var c = this,
d = "<li><div>";
if (d += "<a href='javascript:;' class='" + this.options.playlistOptions.removeItemClass + "'>×</a>", b.free) {
var e = !0;
d += "<span class='" + this.options.playlistOptions.freeGroupClass + "'>(", a.each(b, function(b, f) {
a.jPlayer.prototype.format[b] && (e ? e = !1 : d += " | ", d += "<a class='" + c.options.playlistOptions.freeItemClass + "' href='" + f + "' tabindex='-1'>" + b + "</a>")
}), d += ")</span>"
}
return d += "<a href='javascript:;' class='" + this.options.playlistOptions.itemClass + "' tabindex='0'>" + b.title + (b.artist ? " <span class='jp-artist'>by " + b.artist + "</span>" : "") + "</a>", d + "<a href='#' class='playlist-item-buy'>Buy on iTunes</a>" + "</div></li>"
},
//This is the metabox. I've succesfully added a "link to itunes field" to the bottom of the code.
$meta_boxes[] = array(
'id' => 'album_demo',
'title' => __( 'Album Demo', 'cmb' ),
'pages' => array( 'album', ),
'fields' => array(
array(
'id' => $prefix . 'album_demo',
'type' => 'group',
'description' => __( 'Upload mp3 and ogg files', 'cmb' ),
'options' => array(
'group_title' => __( 'Single {#}', 'cmb' ), // {#} gets replaced by row number
'add_button' => __( 'Add Another Single', 'cmb' ),
'remove_button' => __( 'Remove Single', 'cmb' ),
'sortable' => true, // beta
),
// Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
'fields' => array(
array(
'name' => 'Entry Title',
'id' => 'single_title',
'type' => 'text',
// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
),
array(
'name' => 'Mp3 link',
'id' => 'single_mp3',
'type' => 'text',
// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
),
array(
'name' => 'Ogg Link',
'id' => 'single_ogg',
'type' => 'text',
// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
),
array(
'name' => 'iTunes Link',
'id' => 'single_itunes',
'type' => 'text',
// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
),
),
),
),
);
The trouble I'm having right now is having to link these 2 together. I can provide further code snippets that aren't posted here if it would help.
</div>