Ticket #33755: 33755.15.diff
File 33755.15.diff, 5.5 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/class-wp-custom-logo.php
21 21 * @access public 22 22 */ 23 23 public function __construct() { 24 add_action( 'wp_head', array( $this, 'head_text_styles' ) );25 24 add_action( 'delete_attachment', array( $this, 'delete_attachment_data' ) ); 26 25 } 27 26 28 27 /** 29 * Hides header text on the front end if necessary.30 *31 * @since 4.5.032 * @access public33 */34 public function head_text_styles() {35 // Bail if our theme supports custom headers.36 if ( current_theme_supports( 'custom-header' ) || get_theme_mod( 'custom_logo_header_text', true ) ) {37 return;38 }39 40 // Is Display Header Text unchecked? If so, hide the header text.41 ?>42 <!-- Custom Logo: hide header text -->43 <style type="text/css">44 <?php echo sanitize_html_class( $this->header_text_classes() ); ?> {45 position: absolute;46 clip: rect(1px, 1px, 1px, 1px);47 }48 </style>49 <?php50 }51 52 /**53 28 * Reset the custom logo if the current logo is deleted in the media manager. 54 29 * 55 30 * @since 4.5.0 … … 64 39 remove_theme_mod( 'custom_logo' ); 65 40 } 66 41 } 67 68 /**69 * Retrieves the header text classes.70 *71 * If not defined in add_theme_support(), defaults from Underscores will be used.72 *73 * @since 4.5.074 * @access protected75 *76 * @return string String of classes to hide.77 */78 protected function header_text_classes() {79 $args = get_theme_support( 'custom-logo' );80 81 if ( isset( $args[0]['header-text'] ) ) {82 // Use any classes defined in add_theme_support().83 $classes = $args[0]['header-text'];84 } else {85 // Otherwise, use these defaults, which will work with any Underscores-based theme.86 $classes = array(87 'site-title',88 'site-description',89 );90 }91 92 // If there's an array of classes, reduce them to a string for output.93 if ( is_array( $classes ) ) {94 $classes = array_map( 'sanitize_html_class', $classes );95 $classes = (string) '.' . implode( ', .', $classes );96 } else {97 $classes = (string) '.' . $classes;98 }99 100 return $classes;101 }102 42 } 103 43 104 44 /** -
src/wp-includes/class-wp-customize-manager.php
1922 1922 'section' => 'title_tagline', 1923 1923 ) ); 1924 1924 1925 // Add a setting to hide header text if the theme isn't supporting the feature itself. 1926 // @todo 1927 if ( ! current_theme_supports( 'custom-header' ) ) { 1925 // Add a setting to hide header text if the theme doesn't support custom headers. 1926 if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) { 1928 1927 $this->add_setting( 'header_text', array( 1928 'theme_supports' => array( 'custom-logo', 'header-text' ), 1929 1929 'default' => 1, 1930 1930 'sanitize_callback' => 'absint', 1931 'transport' => 'postMessage',1931 // 'transport' => 'postMessage', 1932 1932 ) ); 1933 1933 1934 1934 $this->add_control( 'header_text', array( -
src/wp-includes/default-filters.php
371 371 */ 372 372 // Theme 373 373 add_action( 'wp_loaded', '_custom_header_background_just_in_time' ); 374 add_action( 'wp_loaded', '_custom_logo_just_in_time' ); 374 375 add_action( 'plugins_loaded', '_wp_customize_include' ); 375 376 add_action( 'admin_enqueue_scripts', '_wp_customize_loader_settings' ); 376 377 add_action( 'delete_attachment', '_delete_attachment_theme_mod' ); -
src/wp-includes/theme.php
1732 1732 } 1733 1733 1734 1734 /** 1735 * Registers the internal custom header and background routines. 1736 * 1737 * @since 4.5.0 1738 * @access private 1739 */ 1740 function _custom_logo_just_in_time() { 1741 if ( ! current_theme_supports( 'custom-header' ) && get_theme_support( 'custom-logo', 'header-text' ) && ! get_theme_mod( 'header_text', true ) ) { 1742 add_action( 'wp_head', '_custom_logo_cb' ); 1743 } 1744 } 1745 1746 /** 1747 * Hides header text for custom logo. 1748 * 1749 * @since 4.5.0 1750 * @access private 1751 */ 1752 function _custom_logo_cb() { 1753 $classes = (array) get_theme_support( 'custom-logo', 'header-text' ); 1754 $classes = array_map( 'sanitize_html_class', $classes ); 1755 $classes = '.' . implode( ', .', $classes ); 1756 1757 ?> 1758 <!-- Custom Logo: hide header text --> 1759 <style type="text/css"> 1760 <?php echo $classes; ?> { 1761 position: absolute; 1762 clip: rect(1px, 1px, 1px, 1px); 1763 } 1764 </style> 1765 <?php 1766 } 1767 1768 /** 1735 1769 * Gets the theme support arguments passed when registering that support 1736 1770 * 1737 1771 * @since 3.1.0 … … 1751 1785 1752 1786 $args = array_slice( func_get_args(), 1 ); 1753 1787 switch ( $feature ) { 1788 case 'custom-logo' : 1754 1789 case 'custom-header' : 1755 1790 case 'custom-background' : 1756 1791 if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) ) … … 1877 1912 $type = $args[0]; 1878 1913 return in_array( $type, $_wp_theme_features[$feature][0] ); 1879 1914 1915 case 'custom-logo': 1880 1916 case 'custom-header': 1881 case 'custom-background' 1917 case 'custom-background': 1882 1918 // specific custom header and background capabilities can be registered by passing 1883 1919 // an array to add_theme_support() 1884 1920 $header_support = $args[0];