我正在努力将jPlayer整合到我们的WordPress网站中。我并不特别关心这两个插件,因为我们的客户端在技术上有点缺陷。我们希望实现的是将标题和Mp3加载到jPlayer播放列表的JavaScript中。目前,一切都很好地加载并返回适当的文本,但是我无法获得文件名和附件URL以适当地加载。在这方面,我对java和wordpress相当陌生。任何帮助都将不胜感激。如果您想查看现场示例,请访问http://www.ourgoodfight.com/?p=6054
<!--Begin Jplayer Playlist -->
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
}, [
<?php
global $post;
$jukebox_args = get_posts( array(
\'post_type\' => \'attachment\',
\'posts_per_page\' => -1,
\'post_mime_type\' => \'audio/mpeg\',
\'orderby\' => \'menu_order\',
\'order\' => \'ASC\',
\'post_parent\' => $post->ID
));
$the_jukebox_query = new WP_Query( $jukebox_args );
?>
<!--This is what needs to loop -->
<?php
$loop = new WP_Query( $jukebox_args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
{
title:<?php echo apply_filters( \'the_title\', $attachment->post_title ); ?>,
mp3:<?php echo wp_get_attachment_url( $attachment->ID, false ); ?>,
},
<?php endwhile;?>
<!--This would be the end of the loop -->
], {
swfPath: "<?php echo get_template_directory_uri(); ?>/js",
supplied: "mp3",
wmode: "window"
});
});
//]]>
</script>