Make WordPress Core

Changeset 46848


Ignore:
Timestamp:
12/09/2019 02:39:30 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Twenty Twenty: Adds Customizer option to show or hide author bio.

This adds an option to the Customizer that allows you to turn the author bio on or off, sitewide.

Props williampatton, nielslange, acosmin, dlh, ianbelanger.
Merges [46813] to the 5.3 branch.
Fixes #48550.

Location:
branches/5.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php

    r46614 r46848  
    206206            );
    207207
    208             /* Enable Header Search --------- */
     208            /* Enable Header Search ----------------------------------------------- */
    209209
    210210            $wp_customize->add_setting(
     
    224224                    'priority' => 10,
    225225                    'label'    => __( 'Show search in header', 'twentytwenty' ),
     226                )
     227            );
     228
     229            /* Show author bio ---------------------------------------------------- */
     230
     231            $wp_customize->add_setting(
     232                'show_author_bio',
     233                array(
     234                    'capability'        => 'edit_theme_options',
     235                    'default'           => true,
     236                    'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ),
     237                )
     238            );
     239
     240            $wp_customize->add_control(
     241                'show_author_bio',
     242                array(
     243                    'type'     => 'checkbox',
     244                    'section'  => 'options',
     245                    'priority' => 10,
     246                    'label'    => __( 'Show author bio', 'twentytwenty' ),
    226247                )
    227248            );
  • branches/5.3/src/wp-content/themes/twentytwenty/template-parts/entry-author-bio.php

    r46614 r46848  
    88 */
    99
    10 if ( (bool) get_the_author_meta( 'description' ) ) : ?>
     10if ( (bool) get_the_author_meta( 'description' ) && (bool) get_theme_mod( 'show_author_bio', true ) ) : ?>
    1111<div class="author-bio">
    1212    <div class="author-title-wrapper">
Note: See TracChangeset for help on using the changeset viewer.