Get author information in WordPress while loop


<?php

while ( have_posts() ) : the_post();

$author_id=$post->post_author;

//Avatar image

echo get_avatar( 32 );

//Author “Nick Name”

echo the_author_meta( ‘user_nicename’ , $author_id );

echo get_userdata($author_id)->nickname;

//Author “Display Name”

echo the_author_meta( ‘display_name’ , $author_id );

//Author “E-Mail address”

echo the_author_meta( ‘user_email’, $author_id );

//Author user loin

echo get_userdata($author_id)->user_login;

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s