我在Wordpress中使用flexslider和自定义帖子来显示滑块(按照https://code.tutsplus.com/articles/create-a-responsive-slider-plugin-with-flexslider-for-wordpress--wp-21839概述的方法)。它非常适合图像,因此我想尝试一些非图像内容,包括iframe。问题是iframe脱离了flexslider容器。这是生成滑块的代码:
function efs_get_slider_four(){
$sliderfour= '<div class="flex-container"><div class="flexslider2"><ul class="slides">';
GLOBAL $post;
$efs_query_four= "post_type=slider-image-four";
query_posts($efs_query_four);
if (have_posts()) : while (have_posts()) : the_post();
$sliderfour.='<li>'. the_content() .'</li>';
endwhile; endif;
wp_reset_query();
$sliderfour.= '</ul></div></div>';
echo $sliderfour;
}
有两篇post_type'slider-image-four'帖子,其中一篇以此为内容:
<div class="iframe-container"><iframe style="border: 0;" src="https://reviews.com/vs/reviews/ourplace" scrolling="no"></iframe></div>
这是生成的HTML --- iframe容器和其他帖子的内容不包含在'li'标签内,希望您能帮助我理解原因。
<div class="iframe-container">
<iframe style="border: 0;" src="https://reviews.com/vs/reviews/ourplace" scrolling="no">
</iframe>
</div>
<p><a href="http://localhost/about-us/reviews/">Read more Reviews</a>…</p>
<p>Welcome to Our Place. You’ll see the difference our care makes!</p>
<div class="flex-container">
<div class="flexslider2">
<ul class="slides">
<li></li>
<li></li>
</ul>
</div>
</div>