Example 1 — Show an author heading
Print the author name on every author archive.
<?php if ( is_author() ) {
echo '<h1>Posts by ' . esc_html( get_the_author_meta( 'display_name', get_query_var( 'author' ) ) ) . '</h1>';
} ?> How It Works
is_author()is true on an author archive.get_query_var( 'author' )gives the author ID.esc_html()keeps the name safe.

