I have an archive page to show each author domain.com/author
. On the archive page for an author domain.com/author/john-doe
I want to display few information like name, e-mail address and role like John Doe / [email protected] / Écrivain
. (Écrivain is the human readable Label for my wordpress writer
role).
I don't want to show the role of the author of the page but the readable role of the author for this archive page.
I know how to display the role of the author of the page (i.e creator of the page) which is of no interest for me here.
For the role, I have to use a short code and I can't succeed in showing the Label of the role with what I was able to find and understand from searching on the Web (I'm not a developer). It's just returning nothing:
// Shortcode pour récupérer le rôle de l'adhérent dans la page de recherche
add_shortcode('adherent_role', 'author_name_shortcode', true);
function author_name_shortcode(){
global $post;
$post_id = $post->ID;
$author = get_role($post_id);
return $author;
}
This is probably a very basic function, but what would you advise to improve it?
administrator
vsAdministrator
?