diff --git a/src/wp-admin/includes/admin.php b/src/wp-admin/includes/admin.php index 7d2437b2b8..a44abba917 100644 --- a/src/wp-admin/includes/admin.php +++ b/src/wp-admin/includes/admin.php @@ -72,9 +72,6 @@ require_once(ABSPATH . 'wp-admin/includes/user.php'); /** WordPress Site Icon API */ require_once(ABSPATH . 'wp-admin/includes/class-wp-site-icon.php'); -/** WordPress Custom Logo API */ -require_once(ABSPATH . 'wp-admin/includes/class-wp-custom-logo.php'); - /** WordPress Update Administration API */ require_once(ABSPATH . 'wp-admin/includes/update.php'); diff --git a/src/wp-admin/includes/class-wp-custom-logo.php b/src/wp-admin/includes/class-wp-custom-logo.php deleted file mode 100644 index 5549eefcb9..0000000000 --- a/src/wp-admin/includes/class-wp-custom-logo.php +++ /dev/null @@ -1,109 +0,0 @@ - - - - 'title_tagline', ) ); - // Add a setting to hide header text if the theme isn't supporting the feature itself. - // @todo - if ( ! current_theme_supports( 'custom-header' ) ) { + // Add a setting to hide header text if the theme doesn't support custom headers. + if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) { $this->add_setting( 'header_text', array( + 'theme_supports' => array( 'custom-logo', 'header-text' ), 'default' => 1, 'sanitize_callback' => 'absint', - 'transport' => 'postMessage', ) ); $this->add_control( 'header_text', array( diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 76111ff428..2ae86d88f5 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -371,6 +371,7 @@ add_action( 'parse_request', 'rest_api_loaded' ); */ // Theme add_action( 'wp_loaded', '_custom_header_background_just_in_time' ); +add_action( 'wp_head', '_custom_logo_header_styles' ); add_action( 'plugins_loaded', '_wp_customize_include' ); add_action( 'admin_enqueue_scripts', '_wp_customize_loader_settings' ); add_action( 'delete_attachment', '_delete_attachment_theme_mod' ); diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index 9973cb5623..87808129ab 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -880,8 +880,7 @@ function get_custom_logo( $blog_id = 0 ) { if ( is_multisite() && ms_is_switched() ) { restore_current_blog(); } - $size = get_theme_support( 'custom-logo' ); - $size = $size[0]['size']; + $size = get_theme_support( 'custom-logo', 'size' ); // We have a logo. Logo is go. if ( $custom_logo_id ) { diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index ba0efbd6d3..15681e5a39 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -1731,6 +1731,30 @@ function _custom_header_background_just_in_time() { } } +/** + * Adds CSS to hide header text for custom logo, based on Customizer setting. + * + * @since 4.5.0 + * @access private + */ +function _custom_logo_header_styles() { + if ( ! current_theme_supports( 'custom-header', 'header-text' ) && get_theme_support( 'custom-logo', 'header-text' ) && ! get_theme_mod( 'header_text', true ) ) { + $classes = (array) get_theme_support( 'custom-logo', 'header-text' ); + $classes = array_map( 'sanitize_html_class', $classes ); + $classes = '.' . implode( ', .', $classes ); + + ?> + + + custom_logo = null; - $this->remove_added_uploads(); - parent::tearDown(); - } - - function test_delete_attachment_data() { - $attachment_id = $this->_insert_attachment(); - set_theme_mod( 'custom_logo', $attachment_id ); - - wp_delete_attachment( $attachment_id, true ); - - $this->assertFalse( get_theme_mod( 'custom_logo' ) ); - } - - function _insert_attachment() { - if ( $this->attachment_id ) { - return $this->attachment_id; - } - - $filename = DIR_TESTDATA . '/images/test-image.jpg'; - $contents = file_get_contents( $filename ); - - $upload = wp_upload_bits( basename( $filename ), null, $contents ); - - $this->attachment_id = $this->_make_attachment( $upload ); - return $this->attachment_id; - } -}