【发布时间】:2016-02-29 13:42:58
【问题描述】:
我正在开发一个自定义 WordPress 主题,根据设计要求,我必须在图像背景中设置作者 Gravatar。
我尝试使用get_avatar_url() 和wp_get_attachment_image_src 如下,但无法实现:
PHP 内嵌代码:
<?php $thumb = wp_get_attachment_image_src(get_avatar_url($post->ID), '80'); ?>
<div class="author" style="background-image: url('<?php echo $thumb[0]; ?>')"></div>
CSS:
.author {
width:120px;
height:120px;
background: no-repeat center;
}
我如何做到这一点?
【问题讨论】:
标签: php css wordpress avatar gravatar