Categories

Saturday, November 23, 2024
#919814419350 therichposts@gmail.com
Wordpress Tricks

How to get Get author avatar for particular user inside the loop?

How to add custom meta title and meta description in Wordpress?

get Get author avatar for particular user inside the loop

Hello, welcome to therichpost.com. In this post, I will tell you, How to get Get author avatar for particular user inside the loop? Like I always say WordPress is the best cms. 

Today In this post, we will get author avatar image in wordpress post loop and there are various methods and here are the working codes:
For comments:
<?php echo get_avatar( $comment, 32 ); ?>

For a post's author, in The Loop:
<?php echo get_avatar( get_the_author_meta( 'ID' ), 32 ); ?>

For a random email address:
<?php echo get_avatar( 'email@example.com', 32 ); ?>

For a specific user id:
<?php  
    $user_id = 2;
    echo get_avatar( $user_id, 32 ); 
?>

 There are so many tricks in wordpress and i will let you know all. Please do comment if you any query   related      to this post. Thank you. Therichpost.com

 

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.