我想提出一個新的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