Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Jplayer与Wordpress集成_Wordpress_Jplayer - Fatal编程技术网

将Jplayer与Wordpress集成

将Jplayer与Wordpress集成,wordpress,jplayer,Wordpress,Jplayer,我想制作一个由添加到Wordpress自定义元框的文件组成的播放列表。jPlayer使用javascript生成列表,有没有办法绕过它而使用常规html 编辑: 或者我可以得到一些关于如何在播放列表中调用wp函数的指导吗?我从中获得了一些想法,但我不确定如何在jquery脚本中创建多个项目/曲目或循环使用它们 new jPlayerPlaylist({ jPlayer: "#jquery_jplayer_2", cssSelectorAncestor: "#jp_containe

我想制作一个由添加到Wordpress自定义元框的文件组成的播放列表。jPlayer使用javascript生成列表,有没有办法绕过它而使用常规html

编辑:

或者我可以得到一些关于如何在播放列表中调用wp函数的指导吗?我从中获得了一些想法,但我不确定如何在jquery脚本中创建多个项目/曲目或循环使用它们

new jPlayerPlaylist({
    jPlayer: "#jquery_jplayer_2",
    cssSelectorAncestor: "#jp_container_2"
}, [
    {
        title:"1",
        mp3:"url/file",
        oga:"url/file"
    },
    {
        title:"2",
        mp3:"url/file",
        oga:"url/file"
    },
], {
    swfPath: "js",
    supplied: "oga, mp3",
    wmode: "window",
    smoothPlayBar: true,
    keyEnabled: true
});
更新:

我现在将我的post_mime_类型作为“$alltracks”回传到jquery脚本中,如下所示:

        <?php
    $query_audio_args = array(
           'post_type' => 'attachment',
           'post_mime_type' =>'application/ogg',
      );


      $audio_attachments = get_posts($query_audio_args);
            foreach ( $audio_attachments as $audio_attachment ) {

                $ogg = wp_get_attachment_url( $audio_attachment->ID );
                $tracks[] = '{
                    title:"'.$audio_attachment->post_title.'",
                    oga:"'.$ogg.'",
                }';
                $alltracks = implode(',',$tracks);
            }
    ?>

        $(document).ready(function() {

    new jPlayerPlaylist({
    jPlayer: "#jquery_jplayer_2",
    cssSelectorAncestor: "#jp_container_2"
}, [
    <?php echo $alltracks; ?>       
], {
    swfPath: "js",
    supplied: "oga, mp3,aif",
    wmode: "window",
    smoothPlayBar: true,
    keyEnabled: true
});

    });

$(文档).ready(函数(){
新的jPlayerPlaylist({
jPlayer:#jquery_jPlayer_2“,
CSS选择器存储:“jp容器2”
}, [
], {
swfPath:“js”,
提供:“oga、mp3、aif”,
wmode:“窗口”,
smoothPlayBar:没错,
keydenabled:true
});
});