[英]wordpress - add author picture on top of the post image
我正在使用wordpress中的自定义主题。 页面“ solutions_page”之一显示所有类别为“ solutions”的帖子,并带有特色图片,标题和一些文本。
在精选图片的顶部,我需要添加一个带有作者照片的圆圈。
这是我的问题,我不知道在哪里或怎么做。 我当时想我应该将div位置绝对放在特色图片上,然后使其变成圆圈。 但是,如果代码中没有特色图片,该怎么办?
这是我的single.php,它没有完成工作,因为我没有看到div的图片:
<?php get_header(); ?>
<div class="container">
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
if (in_category('solutions')) {
the_content();
?>
<div class="authorCircle">
<img src="images/jules.jpg" alt=""/>
</div>
<?php
} else {
the_content();
}
} // end while
} // end if
?>
</div>
<?php
get_footer();
所以authorCircle是我要在帖子内容中看到的“解决方案”类别的div。
有什么想法我该怎么做? 我应该将div放入the_content()吗?
先感谢您!!
请使用此代码,它将在您的代码上显示作者头像。
<?php echo get_avatar( get_the_author_meta('ID'), 60); ?>
分别在上述代码中,您想要获得作者ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.