【发布时间】:2014-09-10 14:50:57
【问题描述】:
我有一个 Html 页面,其中有一个滑块。这是html代码
<div data-thumb="images/slide1.jpg" data-src="images/slide1.jpg">
</div>
<div data-thumb="images/slide2.jpg" data-src="images/slide2.jpg">
</div>
<div data-thumb="images/slide3.jpg" data-src="images/slide3.jpg">
</div>
我正在尝试将此页面转换为 wordpress。这是我在 wordpress 中加载图像的方法。
<?php
$options = array(
'post_type' => "slideshow",
);
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div data-thumb="<?php if ( has_post_thumbnail() ) { the_post_thumbnail('full'); } ?>" data-src="<?php if ( has_post_thumbnail() ) { the_post_thumbnail('full'); } ?>">
</div>
<?php endwhile; ?>
但它不起作用。我的图片没有显示在滑块中。但是当我检查页面源时,它正在正确获取图像。
这里是生成源
<div data-thumb="<img width="1170" height="385" src="http://localhost/wordpress/wp-content/uploads/2014/09/slide1.jpg" class="attachment-full wp-post-image" alt="slide1" />"
data-src="<img width="1170" height="385" src="http://localhost/wordpress/wp- content/uploads/2014/09/slide1.jpg" class="attachment-full wp-post-image" alt="slide1" />">
</div>
【问题讨论】:
-
您在控制台中遇到的任何错误?
标签: php wordpress slider custom-post-type