From 7d94081279f35df4762597948cf3d616404187d2 Mon Sep 17 00:00:00 2001 From: Ian Belanger Date: Thu, 14 May 2020 17:15:41 +0000 Subject: [PATCH] Bundled Themes: Twenty Twenty custom post types that don't support authors, shows author box. This fixes the issue where custom post types will show an author box, even if they don't support authors. Props joyously, donmhico. Fixes #48803. git-svn-id: https://develop.svn.wordpress.org/trunk@47799 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-content/themes/twentytwenty/inc/template-tags.php | 2 +- .../themes/twentytwenty/template-parts/content-cover.php | 2 +- src/wp-content/themes/twentytwenty/template-parts/content.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-content/themes/twentytwenty/inc/template-tags.php b/src/wp-content/themes/twentytwenty/inc/template-tags.php index 95c2e6070b..1f09b966a9 100644 --- a/src/wp-content/themes/twentytwenty/inc/template-tags.php +++ b/src/wp-content/themes/twentytwenty/inc/template-tags.php @@ -338,7 +338,7 @@ function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' ) do_action( 'twentytwenty_start_of_post_meta_list', $post_id, $post_meta, $location ); // Author. - if ( in_array( 'author', $post_meta, true ) ) { + if ( post_type_supports( get_post_type( $post_id ), 'author' ) && in_array( 'author', $post_meta, true ) ) { $has_meta = true; ?> diff --git a/src/wp-content/themes/twentytwenty/template-parts/content-cover.php b/src/wp-content/themes/twentytwenty/template-parts/content-cover.php index 883032e5f3..f1150cb1c5 100644 --- a/src/wp-content/themes/twentytwenty/template-parts/content-cover.php +++ b/src/wp-content/themes/twentytwenty/template-parts/content-cover.php @@ -146,7 +146,7 @@ // Single bottom post meta. twentytwenty_the_post_meta( get_the_ID(), 'single-bottom' ); - if ( is_single() ) { + if ( post_type_supports( get_post_type( get_the_ID() ), 'author' ) && is_single() ) { get_template_part( 'template-parts/entry-author-bio' ); diff --git a/src/wp-content/themes/twentytwenty/template-parts/content.php b/src/wp-content/themes/twentytwenty/template-parts/content.php index 468af0c7e8..ed0cf5173a 100644 --- a/src/wp-content/themes/twentytwenty/template-parts/content.php +++ b/src/wp-content/themes/twentytwenty/template-parts/content.php @@ -57,7 +57,7 @@ // Single bottom post meta. twentytwenty_the_post_meta( get_the_ID(), 'single-bottom' ); - if ( is_single() ) { + if ( post_type_supports( get_post_type( get_the_ID() ), 'author' ) && is_single() ) { get_template_part( 'template-parts/entry-author-bio' );