2013-01-24 23 views
0

我在WordPress和jwplayer中使用anythingslider。我在自定義帖子類型中有一個自定義字段,用於存儲視頻網址或嵌入代碼。Anythingslider jwplayer和WordPress循環?

這是循環我使用的是顯示從自定義字段中的視頻URL或嵌入代碼在滑塊

<ul id="slider"> 
<?php $the_slider = new WP_Query('post_type=product'); while($the_slider->have_posts()) : $the_slider->the_post(); ?> 

    <?php //if(has_post_thumbnail()) { ?> 
    <li> 
    <?php if( get_field('video_preview')) 
    { 
     echo get_field('video_preview'); 
    }?> 
    </li> 
<?php endwhile; ?> 

</ul> 

我需要一些如何包裹get_field到的javascript jwplayer它會是什麼樣子下面。我嘗試了幾種方法,但我認爲JavaScript也越來越循環,而不是工作。我如何創建一個循環來使用上面的代碼使用js?

<script type="text/javascript"> 
    jwplayer("myElement").setup({ 
     file: "http://www.example.com/video.mp4", 
    width: "100%", 
    height: "315px" 
    }); 
</script> 

回答

0

如果你想擁有JW球員總是循環的內容,你只需要改變這段代碼:

height: "315px" 

要這樣:

height: "315px", 
repeat: "true" 

我假設你正在使用JW6。如果你不使用JW6,「重複」選項將是「始終」而不是「真」

希望這有助於!