I am displaying the author name in my author archive template with a dynamic headline but I also want to display a designation. Basically, I would like to display “Founder” if the user ID equals to 1, otherwise I would like to display “Contributor”.
I’ve created a shortcode for this but it doesn’t seem to work:
function display_author_archive_designation() {
$user_info = get_userdata( $user_id );
ob_start();
if ( $user_info->ID === 1 ) {
echo "Founder";
} else {
echo "Contributor";
}
return ob_get_clean();
}
add_shortcode( 'author_archive_designation', 'display_author_archive_designation' );
It always displays “Contributor”. Is there something wrong with the code?