显示作者的头像The Loop 使用get_avatar()
就像这样:
<?php print get_avatar(get_the_author_meta(\'ID\'), \'30\', \'\', \'\', [\'class\' => \'foo-bar\']); ?>
在中显示作者的显示名称
The Loop 使用
the_author()
:
<?php the_author(); ?>
So
put everything inside The Loop 然后:
<?php
while (have_posts()) : the_post();
?>
<div class="row">
<div>
<h1 class="primary-color">
<?php the_title(); ?>
</h1>
<span class="avatar">
<?php print get_avatar(get_the_author_meta(\'ID\'), \'30\', \'\', \'\', [\'class\' => \'foo-bar\']); ?>
</span>
by <span class="primary-color"><?php the_author(); ?></span>
<span class="pipe">|</span>
<span class="date"><?php echo get_the_date(); ?></span>
</div>
</div>
<div class="row">
<?php the_content(); ?>
</div>
<?php endwhile; ?>