M
M
Maxim Borisenko2020-05-25 20:00:11
WordPress
Maxim Borisenko, 2020-05-25 20:00:11

Displaying the WordPress avatar (author of the post), how to display it in a post?

There is a site - https://makbori.ru
In the records, there is a block with the author, I displayed all the data that I need about the author, but the avatar is not displayed, as if it does not exist (by default, "mustachioed man" is set), but in the settings profile, there is an avatar, what could be wrong?

<div class="autor-who">
 			<p> Автор статьи </p>
 			</div>
 			<div class="autor-img">
 			<?php echo get_avatar($author_id); ?>	
 			</div>
 			<div class="autor_name">
 			<p><?php the_author_meta( 'display_name' ); ?>
 			</p>	
 			</div>
 			<div class="link-autor">
 			<p> Ссылка в ВК: <?php the_author_link(); ?></p>
 			</div>
 			<div class="link-autor-new">
 			<a href="">Стать автором</a>	
 			</div>
 			<div class="hr-autor">
 				<hr>
 			</div>
 			<div class="up-ctr">
 			<p> Нашли ошибку? Выделите фрагмент и нажмите ctrl + Enter </p>
 			</div>
 			</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WP Panda, 2020-05-25
@makbori

$author_id is not just a squiggle, it's a variable that should contain the author's ID or electric mail

<?php echo get_avatar( get_the_author_meta('user_email') );  ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question