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

See #32096.
Built from https://develop.svn.wordpress.org/trunk@45720


git-svn-id: http://core.svn.wordpress.org/trunk@45531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-08-02 03:08:55 +00:00
parent e2ea3f7f30
commit b900e22629
2 changed files with 4 additions and 3 deletions

View File

@ -549,13 +549,14 @@ function twentyfifteen_author_bio_template( $template ) {
if ( is_author() ) { if ( is_author() ) {
$author = get_queried_object(); $author = get_queried_object();
if ( $author instanceof WP_User && 'bio' === $author->user_nicename ) { 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; return $template;
} }
add_filter( 'template_include', 'twentyfifteen_author_bio_template' ); add_filter( 'author_template', 'twentyfifteen_author_bio_template' );
/** /**

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-45719'; $wp_version = '5.3-alpha-45720';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.