【发布时间】:2026-01-24 19:35:01
【问题描述】:
由于某种原因get_avatar($user_email, 125); 不起作用。我不知道为什么。这是我在single.php 中的代码:
<?php
$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
$user_email = $curauth->user_email;
?>
<div class="author-box clearfix">
<img class="author" src="<?php echo get_avatar($user_email, 125); ?> " width="125" height="125" alt="<?php echo the_author_meta( 'display_name' , $author_id ); ?>" />
<h4 class="title"><?php echo get_the_author(); ?></h4>
<p class="title"><?php the_author_meta( 'title' ); ?></p>
<p class="info"><strong>M: </strong><?php the_author_meta( 'user_email' ); ?></p>
<p class="info"><strong>W: </strong><a href="<?php the_author_meta( 'user_url' ); ?>"><?php the_author_meta( 'user_url' ); ?></a></p>
</div>
【问题讨论】:
标签: php wordpress avatar author