some way to show the author's role in wordpress for example: Administrator, editor, author, contributor ect...
Let something like this be left:
This post was written by contributor JUan
I'm just using <? php the_author (); ?>
but I can't think of anything else to show the role of the user assigned to a post
some way to show the author's role in wordpress for example: Administrator, editor, author, contributor ect...
Let something like this be left:
This post was written by contributor JUan
I'm just using <? php the_author (); ?>
but I can't think of anything else to show the role of the user assigned to a post
To get author role in single.php you have to get author id first. Use following code to get author id
$author_id = get_the_author_meta( 'ID' );
Then get userdata using
$user = get_user_by( 'ID', $author_id);
or you can use
$user = get_userdata( $author_id );
now you can display role of author using :
echo implode(', ', $user_info->roles);