douzai2562 2015-05-18 09:38
浏览 39

从jPlayer播放列表中每首歌曲旁边的wordpress分配自定义帖子类型的href链接

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 + "'>&times;</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>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求帮我调试一下freefem代码
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图