[英]Show post thumbnail linstead of place holder
I want to add the post thumbnail to the span but I am not to sure how to do that what is my best way to achieve the following i tried 我想将帖子缩略图添加到跨度中,但是我不确定如何做到这一点,这是实现以下尝试的最佳方法
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="single_service_item">
<div class="service_icon transition3s">
<div class="icon_border">
<?php the_post_thumbnail();?>
<span style=" background-image: url("/wp-content/uploads/2016/05/chrome_2017-11-09_10-46-33.png");"></span>
</div>
</div>
<div class="service_text">
<h5><?php the_title();?></h5>
<p><?php the_content();?></p>
</div>
</div>
</div>
But the following is the style of it 但是下面是它的风格
You can see the site here http://ubtanz.solitudesoftware.co.uk/ its the circle image i want to replace with the image of the post thumbnail 您可以在此处http://ubtanz.solitudesoftware.co.uk/上看到该站点。我想用帖子缩略图的图像替换它的圆圈图像
You can use get_the_post_thumbnail_url() to get post thumbnail url. 您可以使用get_the_post_thumbnail_url()获取帖子缩略图网址。
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="single_service_item">
<div class="service_icon transition3s">
<div class="icon_border">
<span style="background-image: url('<?php echo get_the_post_thumbnail_url(get_the_ID(), 'full'); ?>');"></span>
</div>
</div>
<div class="service_text">
<h5><?php the_title(); ?></h5>
<p><?php the_content(); ?></p>
</div>
</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.