Customize: Bring custom-logo args closer to custom-header.
Allows themes to specify the desired width and height of logos, and whether that is flexible or not. Has the benefit of not having to generate a logo-sized file for every image uploaded. Props westonruter, celloexpressions. Fixes #36255. Built from https://develop.svn.wordpress.org/trunk@37077 git-svn-id: http://core.svn.wordpress.org/trunk@37044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f8a66d7bf2
commit
cbbf361c03
|
@ -108,8 +108,11 @@ function twentyfifteen_setup() {
|
||||||
*
|
*
|
||||||
* @since Twenty Fifteen 1.5
|
* @since Twenty Fifteen 1.5
|
||||||
*/
|
*/
|
||||||
add_image_size( 'twentyfifteen-logo', 248, 248 );
|
add_theme_support( 'custom-logo', array(
|
||||||
add_theme_support( 'custom-logo', array( 'size' => 'twentyfifteen-logo' ) );
|
'height' => 248,
|
||||||
|
'width' => 248,
|
||||||
|
'flex-height' => true,
|
||||||
|
) );
|
||||||
|
|
||||||
$color_scheme = twentyfifteen_get_color_scheme();
|
$color_scheme = twentyfifteen_get_color_scheme();
|
||||||
$default_color = trim( $color_scheme[0], '#' );
|
$default_color = trim( $color_scheme[0], '#' );
|
||||||
|
|
|
@ -1959,11 +1959,15 @@ final class WP_Customize_Manager {
|
||||||
'transport' => 'postMessage',
|
'transport' => 'postMessage',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->add_control( new WP_Customize_Media_Control( $this, 'custom_logo', array(
|
$custom_logo_args = get_theme_support( 'custom-logo' );
|
||||||
'label' => __( 'Logo' ),
|
$this->add_control( new WP_Customize_Cropped_Image_Control( $this, 'custom_logo', array(
|
||||||
'section' => 'title_tagline',
|
'label' => __( 'Logo' ),
|
||||||
'priority' => 8,
|
'section' => 'title_tagline',
|
||||||
'mime_type' => 'image',
|
'priority' => 8,
|
||||||
|
'height' => $custom_logo_args[0]['height'],
|
||||||
|
'width' => $custom_logo_args[0]['width'],
|
||||||
|
'flex_height' => $custom_logo_args[0]['flex-height'],
|
||||||
|
'flex_width' => $custom_logo_args[0]['flex-width'],
|
||||||
'button_labels' => array(
|
'button_labels' => array(
|
||||||
'select' => __( 'Select logo' ),
|
'select' => __( 'Select logo' ),
|
||||||
'change' => __( 'Change logo' ),
|
'change' => __( 'Change logo' ),
|
||||||
|
|
|
@ -1559,6 +1559,23 @@ function add_theme_support( $feature ) {
|
||||||
$args[0] = array_merge( $_wp_theme_features['html5'][0], $args[0] );
|
$args[0] = array_merge( $_wp_theme_features['html5'][0], $args[0] );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'custom-logo':
|
||||||
|
$defaults = array(
|
||||||
|
'width' => null,
|
||||||
|
'height' => null,
|
||||||
|
'flex-width' => false,
|
||||||
|
'flex-height' => false,
|
||||||
|
'header-text' => '',
|
||||||
|
);
|
||||||
|
$args[0] = wp_parse_args( array_intersect_key( $args[0], $defaults ), $defaults );
|
||||||
|
|
||||||
|
// Allow full flexibility if no size is specified.
|
||||||
|
if ( is_null( $args[0]['width'] ) && is_null( $args[0]['height'] ) ) {
|
||||||
|
$args[0]['flex-width'] = true;
|
||||||
|
$args[0]['flex-height'] = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'custom-header-uploads' :
|
case 'custom-header-uploads' :
|
||||||
return add_theme_support( 'custom-header', array( 'uploads' => true ) );
|
return add_theme_support( 'custom-header', array( 'uploads' => true ) );
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-beta4-37076';
|
$wp_version = '4.5-beta4-37077';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue