<?php while (have_posts()) : the_post(); ?>
<section class="panel panel-white">
<div class="row single-post-content">
<?php if ($category_name !== 'Jobs') { ?>
<h5 class="author-post__title"><?php the_author() ?></h5>
<p><?php echo get_the_date(); ?></p>
<?php }
the_content();
if ($category_name !== 'Jobs') { ?>
<div class="row author-post">
<div class="small-12 medium-4 column">
<img src="<?php echo get_avatar(); ?>" alt="" />
</div>
<div class="small-12 medium-8 column">
<h5 class="author-post__title"><?php the_author() ?></h5>
<p>
Lorem Ipsum has been the industry's standard dummy text
ever since the 1500s, when an unknown printer took a
galley of type and scrambled it to make a type specimen
book. It has survived not only five centuries, but
also the leap into electronic typesetting, remaining
essentially unchanged. It was popularised in the 1960s
with the release of Letraset sheets containing.
</p>
</div>
</div>
<?php } ?>
</div>
</section>
<?php endwhile;?>
我试图通过撰写帖子的作者的头像。 我认为这会使这项工作,但它似乎并没有输出正确的网址,并给了我一个404图像。WordPress的 - 获取作者图片
其他人通过头像图像做了什么方法?
我正在寻找一个答案,告诉我如何做到这一点,如果没有图像不显示一个。
UPDATE:
我曾尝试使用下面的代码,使这项工作:我要指出,我试图让我的本地机器上的这项工作为好。
echo get_avatar($authorId, 100);
(变量使用get_the_author_id()
)
我已经添加了一个更新我的问题 –