Twenty Fifteen: Make twentyfifteen_author_bio_template() use author templates if exist, fall back to regular template hierarchy otherwise.

See #32096.

git-svn-id: https://develop.svn.wordpress.org/trunk@45720 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-08-02 03:07:58 +00:00
parent 35e070ca34
commit ce00f0b0f4

View File

@ -549,13 +549,14 @@ function twentyfifteen_author_bio_template( $template ) {
if ( is_author() ) {
$author = get_queried_object();
if ( $author instanceof WP_User && 'bio' === $author->user_nicename ) {
return locate_template( array( 'archive.php', 'index.php' ) );
// Use author templates if exist, fall back to template hierarchy otherwise.
return locate_template( array( "author-{$author->ID}.php", 'author.php' ) );
}
}
return $template;
}
add_filter( 'template_include', 'twentyfifteen_author_bio_template' );
add_filter( 'author_template', 'twentyfifteen_author_bio_template' );
/**