我有一个使用caroufredsel的自定义帖子类型,它工作正常,但我也想添加视频。我当前的代码是:
//初始化滑块
function ikos_slider_initialize() { ?>
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(function() {
$j(\'#carousel\').carouFredSel({
responsive: true,
items: {
visible: 1,
width: 900,
height: 500
},
pagination: \'#pager\'
});
});
</script>
<?php }
add_action( \'wp_head\', \'ikos_slider_initialize\' );
//创建滑块function ikos_slider_template() {
// Query Arguments
$args = array(
\'post_type\' => \'slides\',
\'posts_per_page\' => 5
);
// The Query
$the_query = new WP_Query( $args );
// Check if the Query returns any posts
if ( $the_query->have_posts() ) {
?>
<!-- begin slider -->
<div id="wrapper">
<div id="carousel">
<?php
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div id="item">
<?php
// Check if there\'s a Slide URL given and if so let\'s a link to it
if ( get_post_meta( get_the_id(), \'ikos_slideurl\', true) != \'\' ) { ?>
<a href="<?php echo esc_url( get_post_meta( get_the_id(), \'ikos_slideurl\', true ) ); ?>">
<?php }
// The Slide\'s Image
echo the_post_thumbnail(\'slider\');
// Close off the Slide\'s Link if there is one
if ( get_post_meta( get_the_id(), \'ikos_slideurl\', true) != \'\' ) { ?>
</a>
<?php } ?>
</div> <!-- end item -->
<?php endwhile; wp_reset_query(); ?>
</div><!-- end carousel-wrapper -->
<div id="pager"></div>
</div>
<!-- end slider wrap -->
<?php }
// Reset Post Data
wp_reset_postdata();
}
因此,我希望能够添加视频(youtube、wordpress、vimeo,任何解决方案都可以)我尝试添加具有以下代码的元盒:http://wp.tutsplus.com/tutorials/creative-coding/youtube-and-vimeo-video-gallery-with-wordpress/
但我让播放器一直显示错误。。
是否有方法添加元盒以及如何在滑块内容的项目内显示它?我试着在metabox中粘贴wordpress生成[视频]的短代码,但它不起作用。当我保存metabox时,会删除=。(仅显示:[视频flv=)
救命啊!