From 46cffd88e50af12278438b6c32e0ec7810048eaf Mon Sep 17 00:00:00 2001 From: Ian Belanger Date: Wed, 4 Dec 2019 15:57:54 +0000 Subject: [PATCH] Bundled Themes: Adds Customizer option to show or hide author bio Twenty Twenty. This adds an option to the Customizer that allows you to turn the author bio on or off, sitewide. Props williampatton, nielslange acosmin, dlh. Fixes #48550. git-svn-id: https://develop.svn.wordpress.org/trunk@46813 602fd350-edb4-49c9-b593-d223f7449a82 --- .../classes/class-twentytwenty-customize.php | 23 ++++++++++++++++++- .../template-parts/entry-author-bio.php | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php b/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php index 1992b059a0..cec2496149 100644 --- a/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php +++ b/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php @@ -205,7 +205,7 @@ if ( ! class_exists( 'TwentyTwenty_Customize' ) ) { ) ); - /* Enable Header Search --------- */ + /* Enable Header Search ----------------------------------------------- */ $wp_customize->add_setting( 'enable_header_search', @@ -226,6 +226,27 @@ if ( ! class_exists( 'TwentyTwenty_Customize' ) ) { ) ); + /* Show author bio ---------------------------------------------------- */ + + $wp_customize->add_setting( + 'show_author_bio', + array( + 'capability' => 'edit_theme_options', + 'default' => true, + 'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ), + ) + ); + + $wp_customize->add_control( + 'show_author_bio', + array( + 'type' => 'checkbox', + 'section' => 'options', + 'priority' => 10, + 'label' => __( 'Show author bio', 'twentytwenty' ), + ) + ); + /* Display full content or excerpts on the blog and archives --------- */ $wp_customize->add_setting( diff --git a/src/wp-content/themes/twentytwenty/template-parts/entry-author-bio.php b/src/wp-content/themes/twentytwenty/template-parts/entry-author-bio.php index 657b94835d..14553c66fc 100644 --- a/src/wp-content/themes/twentytwenty/template-parts/entry-author-bio.php +++ b/src/wp-content/themes/twentytwenty/template-parts/entry-author-bio.php @@ -7,7 +7,7 @@ * @since 1.0.0 */ -if ( (bool) get_the_author_meta( 'description' ) ) : ?> +if ( (bool) get_the_author_meta( 'description' ) && (bool) get_theme_mod( 'show_author_bio', true ) ) : ?>