Show different badge based upon the user role

You can use get_queried_object to get data in the current author page:

<?php

$author = get_queried_object();

// uncomment next line to see all author data
// print_r( $author );

if( in_array( 'author', $author->roles ) ) :

    echo "author";

elseif( in_array( 'subscriber', $author->roles ) ) :

    echo "subscriber";

endif;

Leave a Comment