How to display Author Box on all pages of author archives in Genesis

Posted on

In Genesis Slack chat a user asks,

I just noticed that when you click an Author name on a post which takes you to the Author Archive, if there is more than one page – the Author box isn’t on page 2, 3, etc. Is there a way to get the Author box to show up on subsequent pages?

genesis_do_author_box_archive() in genesis/lib/structure/archive.php is set to display the author box (when enabled) only on the first page of author archives but not on subsequent paginated pages (Ex.: http://example.com/author/admin/page/2/). We can rewrite the function to remove that condition like so:

remove_action( 'genesis_before_loop', 'genesis_do_author_box_archive', 15 );
add_action( 'genesis_before_loop', 'sk_do_author_box_archive', 15 );
/**
 * Add author box to the top of author archive.
 *
 * If the headline and description are set to display the author box appears underneath them.
 *
 * @since 1.4.0
 *
 * @uses genesis_author_box() Echo the author box and its contents.
 *
 * @see genesis_do_author_title_and_description Author title and description.
 *
 * @return Return early if not author archive.
 */
function sk_do_author_box_archive() {

	if ( ! is_author() )
		return;

	if ( get_the_author_meta( 'genesis_author_box_archive', get_query_var( 'author' ) ) )
		genesis_author_box( 'archive' );

}

Adding the above in child theme’s functions.php displays the author box on paginated pages as well.