我想提出一个新的WordPress主题,头部滑块(我用BXslider)我坚持内联CSS的事情 我想使用此代码 http://jsfiddle.net/0nj2ry4n/1/为什么get_post_thumbnail函数没有输出缩略图的url?
但是,我无法使用the_post_thumbnail($大小)在线工作时CSS背景
<li style='background-image: url(the_post_thumbnail($size));'>
我的代码是
while($slider->have_posts()): $slider->the_post();
$myimg = get_post_thumbnail('myslider');
echo "<li class='featured-post' style='background-image: url('$myimg');'>";
echo "</li>";
endwhile; wp_reset_postdata();
echo "</ul>";
*更新*
现在,如果我试过$ myimg = the_post_thumbnail_url('myslider');得到这种类型的HTML,但我仍然没有弄清楚如何解决这个问题。
<ul class="slider slides" style="width: auto; position: relative;">
http://localhost/demo/myweb/wp-content/uploads/2017/03/AAC-CAREERS2-1349x499.jpg
<li class="featured-post" style="background-image: url(""); float: none; list-style: outside none none; position: absolute; width: 1583px; z-index: 50; display: block;" ');'="">
这是一个WordPress的问题。你应该使用WordPress的堆栈。 – Cam
@Cam这里已经有111,000个问题用'Wordpress'标记了。还有一个不会伤害。 – vlasits
我确信有11.1万人不知道有一个WordPress的堆栈...知识就是力量我的朋友。 – Cam