Customize: Site logos are custom logos.

Brings the nomenclature closer to custom headers and backgrounds.

See https://wordpress.slack.com/archives/core/p1456955151003150
See #35945. 

Built from https://develop.svn.wordpress.org/trunk@36837


git-svn-id: http://core.svn.wordpress.org/trunk@36804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Konstantin Obenland 2016-03-03 19:56:26 +00:00
parent a9e4d9c7f4
commit 147d6d7d6c
15 changed files with 98 additions and 104 deletions

View File

@ -721,7 +721,7 @@ p.customize-section-description {
.customize-control-background .current, .customize-control-background .current,
.customize-control-cropped_image .current, .customize-control-cropped_image .current,
.customize-control-site_icon .current, .customize-control-site_icon .current,
.customize-control-site_logo .current, .customize-control-custom_logo .current,
.customize-control-header .current { .customize-control-header .current {
margin-bottom: 8px; margin-bottom: 8px;
} }
@ -763,9 +763,9 @@ p.customize-section-description {
.customize-control-site_icon .remove-button, .customize-control-site_icon .remove-button,
.customize-control-site_icon .default-button, .customize-control-site_icon .default-button,
.customize-control-site_icon .upload-button, .customize-control-site_icon .upload-button,
.customize-control-site_logo .remove-button, .customize-control-custom_logo .remove-button,
.customize-control-site_logo .default-button, .customize-control-custom_logo .default-button,
.customize-control-site_logo .upload-button, .customize-control-custom_logo .upload-button,
.customize-control-header button.new, .customize-control-header button.new,
.customize-control-header button.remove { .customize-control-header button.remove {
white-space: normal; white-space: normal;
@ -779,7 +779,7 @@ p.customize-section-description {
.customize-control-background .current .container, .customize-control-background .current .container,
.customize-control-cropped_image .current .container, .customize-control-cropped_image .current .container,
.customize-control-site_icon .current .container, .customize-control-site_icon .current .container,
.customize-control-site_logo .current .container, .customize-control-custom_logo .current .container,
.customize-control-header .current .container { .customize-control-header .current .container {
overflow: hidden; overflow: hidden;
-webkit-border-radius: 2px; -webkit-border-radius: 2px;
@ -793,7 +793,7 @@ p.customize-section-description {
.customize-control-background .current .container, .customize-control-background .current .container,
.customize-control-cropped_image .current .container, .customize-control-cropped_image .current .container,
.customize-control-site_icon .current .container, .customize-control-site_icon .current .container,
.customize-control-site_logo .current .container, .customize-control-custom_logo .current .container,
.customize-control-image .current .container { .customize-control-image .current .container {
min-height: 40px; min-height: 40px;
} }
@ -822,7 +822,7 @@ p.customize-section-description {
.customize-control-background .inner, .customize-control-background .inner,
.customize-control-cropped_image .inner, .customize-control-cropped_image .inner,
.customize-control-site_icon .inner, .customize-control-site_icon .inner,
.customize-control-site_logo .inner, .customize-control-custom_logo .inner,
.customize-control-header .inner { .customize-control-header .inner {
display: none; display: none;
position: absolute; position: absolute;
@ -838,7 +838,7 @@ p.customize-section-description {
.customize-control-background .inner, .customize-control-background .inner,
.customize-control-cropped_image .inner, .customize-control-cropped_image .inner,
.customize-control-site_icon .inner, .customize-control-site_icon .inner,
.customize-control-site_logo .inner, .customize-control-custom_logo .inner,
.customize-control-image .inner { .customize-control-image .inner {
display: block; display: block;
min-height: 40px; min-height: 40px;
@ -850,7 +850,7 @@ p.customize-section-description {
.customize-control-background .inner, .customize-control-background .inner,
.customize-control-cropped_image .inner, .customize-control-cropped_image .inner,
.customize-control-site_icon .inner, .customize-control-site_icon .inner,
.customize-control-site_logo.inner, .customize-control-custom_logo.inner,
.customize-control-header .inner, .customize-control-header .inner,
.customize-control-header .inner .dashicons { .customize-control-header .inner .dashicons {
line-height: 20px; line-height: 20px;
@ -994,8 +994,8 @@ p.customize-section-description {
.customize-control-cropped_image .default-button, .customize-control-cropped_image .default-button,
.customize-control-site_icon .remove-button, .customize-control-site_icon .remove-button,
.customize-control-site_icon .default-button, .customize-control-site_icon .default-button,
.customize-control-site_logo .remove-button, .customize-control-custom_logo .remove-button,
.customize-control-site_logo .default-button, .customize-control-custom_logo .default-button,
.customize-control-header .remove { .customize-control-header .remove {
float: right; float: right;
margin-left: 3px; margin-left: 3px;
@ -1007,7 +1007,7 @@ p.customize-section-description {
.customize-control-background .upload-button, .customize-control-background .upload-button,
.customize-control-cropped_image .upload-button, .customize-control-cropped_image .upload-button,
.customize-control-site_icon .upload-button, .customize-control-site_icon .upload-button,
.customize-control-site_logo .upload-button, .customize-control-custom_logo .upload-button,
.customize-control-header .new { .customize-control-header .new {
float: left; float: left;
} }

File diff suppressed because one or more lines are too long

View File

@ -721,7 +721,7 @@ p.customize-section-description {
.customize-control-background .current, .customize-control-background .current,
.customize-control-cropped_image .current, .customize-control-cropped_image .current,
.customize-control-site_icon .current, .customize-control-site_icon .current,
.customize-control-site_logo .current, .customize-control-custom_logo .current,
.customize-control-header .current { .customize-control-header .current {
margin-bottom: 8px; margin-bottom: 8px;
} }
@ -763,9 +763,9 @@ p.customize-section-description {
.customize-control-site_icon .remove-button, .customize-control-site_icon .remove-button,
.customize-control-site_icon .default-button, .customize-control-site_icon .default-button,
.customize-control-site_icon .upload-button, .customize-control-site_icon .upload-button,
.customize-control-site_logo .remove-button, .customize-control-custom_logo .remove-button,
.customize-control-site_logo .default-button, .customize-control-custom_logo .default-button,
.customize-control-site_logo .upload-button, .customize-control-custom_logo .upload-button,
.customize-control-header button.new, .customize-control-header button.new,
.customize-control-header button.remove { .customize-control-header button.remove {
white-space: normal; white-space: normal;
@ -779,7 +779,7 @@ p.customize-section-description {
.customize-control-background .current .container, .customize-control-background .current .container,
.customize-control-cropped_image .current .container, .customize-control-cropped_image .current .container,
.customize-control-site_icon .current .container, .customize-control-site_icon .current .container,
.customize-control-site_logo .current .container, .customize-control-custom_logo .current .container,
.customize-control-header .current .container { .customize-control-header .current .container {
overflow: hidden; overflow: hidden;
-webkit-border-radius: 2px; -webkit-border-radius: 2px;
@ -793,7 +793,7 @@ p.customize-section-description {
.customize-control-background .current .container, .customize-control-background .current .container,
.customize-control-cropped_image .current .container, .customize-control-cropped_image .current .container,
.customize-control-site_icon .current .container, .customize-control-site_icon .current .container,
.customize-control-site_logo .current .container, .customize-control-custom_logo .current .container,
.customize-control-image .current .container { .customize-control-image .current .container {
min-height: 40px; min-height: 40px;
} }
@ -822,7 +822,7 @@ p.customize-section-description {
.customize-control-background .inner, .customize-control-background .inner,
.customize-control-cropped_image .inner, .customize-control-cropped_image .inner,
.customize-control-site_icon .inner, .customize-control-site_icon .inner,
.customize-control-site_logo .inner, .customize-control-custom_logo .inner,
.customize-control-header .inner { .customize-control-header .inner {
display: none; display: none;
position: absolute; position: absolute;
@ -838,7 +838,7 @@ p.customize-section-description {
.customize-control-background .inner, .customize-control-background .inner,
.customize-control-cropped_image .inner, .customize-control-cropped_image .inner,
.customize-control-site_icon .inner, .customize-control-site_icon .inner,
.customize-control-site_logo .inner, .customize-control-custom_logo .inner,
.customize-control-image .inner { .customize-control-image .inner {
display: block; display: block;
min-height: 40px; min-height: 40px;
@ -850,7 +850,7 @@ p.customize-section-description {
.customize-control-background .inner, .customize-control-background .inner,
.customize-control-cropped_image .inner, .customize-control-cropped_image .inner,
.customize-control-site_icon .inner, .customize-control-site_icon .inner,
.customize-control-site_logo.inner, .customize-control-custom_logo.inner,
.customize-control-header .inner, .customize-control-header .inner,
.customize-control-header .inner .dashicons { .customize-control-header .inner .dashicons {
line-height: 20px; line-height: 20px;
@ -994,8 +994,8 @@ p.customize-section-description {
.customize-control-cropped_image .default-button, .customize-control-cropped_image .default-button,
.customize-control-site_icon .remove-button, .customize-control-site_icon .remove-button,
.customize-control-site_icon .default-button, .customize-control-site_icon .default-button,
.customize-control-site_logo .remove-button, .customize-control-custom_logo .remove-button,
.customize-control-site_logo .default-button, .customize-control-custom_logo .default-button,
.customize-control-header .remove { .customize-control-header .remove {
float: left; float: left;
margin-right: 3px; margin-right: 3px;
@ -1007,7 +1007,7 @@ p.customize-section-description {
.customize-control-background .upload-button, .customize-control-background .upload-button,
.customize-control-cropped_image .upload-button, .customize-control-cropped_image .upload-button,
.customize-control-site_icon .upload-button, .customize-control-site_icon .upload-button,
.customize-control-site_logo .upload-button, .customize-control-custom_logo .upload-button,
.customize-control-header .new { .customize-control-header .new {
float: right; float: right;
} }

File diff suppressed because one or more lines are too long

View File

@ -72,7 +72,7 @@ require_once(ABSPATH . 'wp-admin/includes/user.php');
/** WordPress Site Icon API */ /** WordPress Site Icon API */
require_once(ABSPATH . 'wp-admin/includes/class-wp-site-icon.php'); require_once(ABSPATH . 'wp-admin/includes/class-wp-site-icon.php');
/** WordPress Site Logo API */ /** WordPress Custom Logo API */
require_once(ABSPATH . 'wp-admin/includes/class-wp-site-logo.php'); require_once(ABSPATH . 'wp-admin/includes/class-wp-site-logo.php');
/** WordPress Update Administration API */ /** WordPress Update Administration API */

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* Administration API: WP_Site_Logo class * Administration API: WP_Custom_Logo class
* *
* @package WordPress * @package WordPress
* @subpackage Administration * @subpackage Administration
@ -8,11 +8,11 @@
*/ */
/** /**
* Core class used to implement site logo functionality. * Core class used to implement custom logo functionality.
* *
* @since 4.5.0 * @since 4.5.0
*/ */
class WP_Site_Logo { class WP_Custom_Logo {
/** /**
* Get current logo settings stored in theme mod. * Get current logo settings stored in theme mod.
@ -34,13 +34,13 @@ class WP_Site_Logo {
*/ */
public function head_text_styles() { public function head_text_styles() {
// Bail if our theme supports custom headers. // Bail if our theme supports custom headers.
if ( current_theme_supports( 'custom-header' ) || get_theme_mod( 'site_logo_header_text', true ) ) { if ( current_theme_supports( 'custom-header' ) || get_theme_mod( 'custom_logo_header_text', true ) ) {
return; return;
} }
// Is Display Header Text unchecked? If so, hide the header text. // Is Display Header Text unchecked? If so, hide the header text.
?> ?>
<!-- Site Logo: hide header text --> <!-- Custom Logo: hide header text -->
<style type="text/css"> <style type="text/css">
<?php echo sanitize_html_class( $this->header_text_classes() ); ?> { <?php echo sanitize_html_class( $this->header_text_classes() ); ?> {
position: absolute; position: absolute;
@ -51,7 +51,7 @@ class WP_Site_Logo {
} }
/** /**
* Resets the site logo if the current logo is deleted in the media manager. * Reset the custom logo if the current logo is deleted in the media manager.
* *
* @since 4.5.0 * @since 4.5.0
* @access public * @access public
@ -59,10 +59,10 @@ class WP_Site_Logo {
* @param int $post_id Post ID. * @param int $post_id Post ID.
*/ */
public function delete_attachment_data( $post_id ) { public function delete_attachment_data( $post_id ) {
$site_logo_id = get_theme_mod( 'site_logo' ); $custom_logo_id = get_theme_mod( 'custom_logo' );
if ( $site_logo_id && $site_logo_id == $post_id ) { if ( $custom_logo_id && $custom_logo_id == $post_id ) {
remove_theme_mod( 'site_logo' ); remove_theme_mod( 'custom_logo' );
} }
} }
@ -105,7 +105,7 @@ class WP_Site_Logo {
* @return string String of classes to hide. * @return string String of classes to hide.
*/ */
protected function header_text_classes() { protected function header_text_classes() {
$args = get_theme_support( 'site-logo' ); $args = get_theme_support( 'custom-logo' );
if ( isset( $args[0]['header-text'] ) ) { if ( isset( $args[0]['header-text'] ) ) {
// Use any classes defined in add_theme_support(). // Use any classes defined in add_theme_support().
@ -131,8 +131,8 @@ class WP_Site_Logo {
} }
/** /**
* WP_Site_Logo instance. * WP_Custom_Logo instance.
* *
* @global WP_Site_Logo $wp_site_logo * @global WP_Custom_Logo $wp_custom_logo
*/ */
$GLOBALS['wp_site_logo'] = new WP_Site_Logo; $GLOBALS['wp_custom_logo'] = new WP_Custom_Logo;

View File

@ -2303,14 +2303,14 @@
}); });
/** /**
* A control for selecting Site Logos. * A control for selecting custom logos.
* *
* @class * @class
* @augments wp.customize.MediaControl * @augments wp.customize.MediaControl
* @augments wp.customize.Control * @augments wp.customize.Control
* @augments wp.customize.Class * @augments wp.customize.Class
*/ */
api.SiteLogoControl = api.MediaControl.extend({ api.CustomLogoControl = api.MediaControl.extend({
/** /**
* When the control's DOM structure is ready, * When the control's DOM structure is ready,
@ -2330,7 +2330,7 @@
control.setting.bind( function( attachmentId ) { control.setting.bind( function( attachmentId ) {
wp.media.attachment( attachmentId ).fetch().done( function() { wp.media.attachment( attachmentId ).fetch().done( function() {
wp.customize.previewer.send( 'site-logo-attachment-data', this.attributes ); wp.customize.previewer.send( 'custom-logo-attachment-data', this.attributes );
} ); } );
// Re-render whenever the control's setting changes. // Re-render whenever the control's setting changes.
@ -3245,7 +3245,7 @@
image: api.ImageControl, image: api.ImageControl,
cropped_image: api.CroppedImageControl, cropped_image: api.CroppedImageControl,
site_icon: api.SiteIconControl, site_icon: api.SiteIconControl,
site_logo: api.SiteLogoControl, custom_logo: api.CustomLogoControl,
header: api.HeaderControl, header: api.HeaderControl,
background: api.BackgroundControl, background: api.BackgroundControl,
theme: api.ThemeControl theme: api.ThemeControl

File diff suppressed because one or more lines are too long

View File

@ -1848,7 +1848,7 @@ final class WP_Customize_Manager {
$this->register_control_type( 'WP_Customize_Background_Image_Control' ); $this->register_control_type( 'WP_Customize_Background_Image_Control' );
$this->register_control_type( 'WP_Customize_Cropped_Image_Control' ); $this->register_control_type( 'WP_Customize_Cropped_Image_Control' );
$this->register_control_type( 'WP_Customize_Site_Icon_Control' ); $this->register_control_type( 'WP_Customize_Site_Icon_Control' );
$this->register_control_type( 'WP_Customize_Site_Logo_Control' ); $this->register_control_type( 'WP_Customize_Custom_Logo_Control' );
$this->register_control_type( 'WP_Customize_Theme_Control' ); $this->register_control_type( 'WP_Customize_Theme_Control' );
/* Themes */ /* Themes */
@ -1960,22 +1960,22 @@ final class WP_Customize_Manager {
'width' => 512, 'width' => 512,
) ) ); ) ) );
$this->add_setting( 'site_logo', array( $this->add_setting( 'custom_logo', array(
'theme_supports' => array( 'site-logo' ), 'theme_supports' => array( 'custom-logo' ),
'transport' => 'postMessage', 'transport' => 'postMessage',
) ); ) );
$this->add_control( new WP_Customize_Site_Logo_Control( $this, 'site_logo', array( $this->add_control( new WP_Customize_Custom_Logo_Control( $this, 'custom_logo', array(
'label' => __( 'Logo' ), 'label' => __( 'Logo' ),
'section' => 'title_tagline', 'section' => 'title_tagline',
'priority' => 0, 'priority' => 0,
) ) ); ) ) );
if ( isset( $this->selective_refresh ) ) { if ( isset( $this->selective_refresh ) ) {
$this->selective_refresh->add_partial( 'site_logo', array( $this->selective_refresh->add_partial( 'custom_logo', array(
'settings' => array( 'site_logo' ), 'settings' => array( 'custom_logo' ),
'selector' => '.site-logo-link', 'selector' => '.custom-logo-link',
'render_callback' => array( $this, '_render_site_logo_partial' ), 'render_callback' => array( $this, '_render_custom_logo_partial' ),
'container_inclusive' => true, 'container_inclusive' => true,
) ); ) );
} }
@ -2211,10 +2211,10 @@ final class WP_Customize_Manager {
} }
/** /**
* Callback for rendering the site logo, used in the site_logo partial. * Callback for rendering the custom logo, used in the custom_logo partial.
* *
* This method exists because the partial object and context data are passed * This method exists because the partial object and context data are passed
* into a partial's render_callback so we cannot use get_the_site_logo() as * into a partial's render_callback so we cannot use get_custom_logo() as
* the render_callback directly since it expects a blog ID as the first * the render_callback directly since it expects a blog ID as the first
* argument. When WP no longer supports PHP 5.3, this method can be removed * argument. When WP no longer supports PHP 5.3, this method can be removed
* in favor of an anonymous function. * in favor of an anonymous function.
@ -2224,10 +2224,10 @@ final class WP_Customize_Manager {
* @since 4.5.0 * @since 4.5.0
* @access private * @access private
* *
* @return string Site logo. * @return string Custom logo.
*/ */
public function _render_site_logo_partial() { public function _render_custom_logo_partial() {
return get_the_site_logo(); return get_custom_logo();
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* Customize API: WP_Customize_Site_Logo_Control class * Customize API: WP_Customize_Custom_Logo_Control class
* *
* @package WordPress * @package WordPress
* @subpackage Customize * @subpackage Customize
@ -8,7 +8,7 @@
*/ */
/** /**
* Customize Site Logo control class. * Customize custom logo control class.
* *
* Used only for custom functionality in JavaScript. * Used only for custom functionality in JavaScript.
* *
@ -16,7 +16,7 @@
* *
* @see WP_Customize_Image_Control * @see WP_Customize_Image_Control
*/ */
class WP_Customize_Site_Logo_Control extends WP_Customize_Image_Control { class WP_Customize_Custom_Logo_Control extends WP_Customize_Image_Control {
/** /**
* Control type. * Control type.
@ -25,7 +25,7 @@ class WP_Customize_Site_Logo_Control extends WP_Customize_Image_Control {
* @access public * @access public
* @var string * @var string
*/ */
public $type = 'site_logo'; public $type = 'custom_logo';
/** /**
* Constructor. * Constructor.

View File

@ -839,56 +839,56 @@ function has_site_icon( $blog_id = 0 ) {
} }
/** /**
* Whether the site has a Site Logo. * Whether the site has a custom logo.
* *
* @since 4.5.0 * @since 4.5.0
* *
* @param int $blog_id Optional. ID of the blog in question. Default current blog. * @param int $blog_id Optional. ID of the blog in question. Default current blog.
* @return bool Whether the site has a site logo or not. * @return bool Whether the site has a custom logo or not.
*/ */
function has_site_logo( $blog_id = 0 ) { function has_custom_logo( $blog_id = 0 ) {
if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) { if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) {
switch_to_blog( $blog_id ); switch_to_blog( $blog_id );
} }
$site_logo_id = get_theme_mod( 'site_logo' ); $custom_logo_id = get_theme_mod( 'custom_logo' );
if ( is_multisite() && ms_is_switched() ) { if ( is_multisite() && ms_is_switched() ) {
restore_current_blog(); restore_current_blog();
} }
return (bool) $site_logo_id; return (bool) $custom_logo_id;
} }
/** /**
* Returns a Site Logo, linked to home. * Returns a custom logo, linked to home.
* *
* @since 4.5.0 * @since 4.5.0
* *
* @param int $blog_id Optional. ID of the blog in question. Default current blog. * @param int $blog_id Optional. ID of the blog in question. Default current blog.
* @return string Site logo markup. * @return string Custom logo markup.
*/ */
function get_the_site_logo( $blog_id = 0 ) { function get_custom_logo( $blog_id = 0 ) {
$html = ''; $html = '';
if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) { if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) {
switch_to_blog( $blog_id ); switch_to_blog( $blog_id );
} }
$site_logo_id = get_theme_mod( 'site_logo' ); $custom_logo_id = get_theme_mod( 'custom_logo' );
if ( is_multisite() && ms_is_switched() ) { if ( is_multisite() && ms_is_switched() ) {
restore_current_blog(); restore_current_blog();
} }
$size = get_theme_support( 'site-logo' ); $size = get_theme_support( 'custom-logo' );
$size = $size[0]['size']; $size = $size[0]['size'];
// We have a logo. Logo is go. // We have a logo. Logo is go.
if ( $site_logo_id ) { if ( $custom_logo_id ) {
$html = sprintf( '<a href="%1$s" class="site-logo-link" rel="home" itemprop="url">%2$s</a>', $html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
esc_url( home_url( '/' ) ), esc_url( home_url( '/' ) ),
wp_get_attachment_image( $site_logo_id, $size, false, array( wp_get_attachment_image( $custom_logo_id, $size, false, array(
'class' => "site-logo attachment-$size", 'class' => "custom-logo attachment-$size",
'data-size' => $size, 'data-size' => $size,
'itemprop' => 'logo', 'itemprop' => 'logo',
) ) ) )
@ -897,32 +897,32 @@ function get_the_site_logo( $blog_id = 0 ) {
// If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview). // If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview).
elseif ( is_customize_preview() ) { elseif ( is_customize_preview() ) {
$html = sprintf( '<a href="%1$s" class="site-logo-link" style="display:none;"><img class="site-logo" data-size="%2$s" /></a>', $html = sprintf( '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo" data-size="%2$s" /></a>',
esc_url( home_url( '/' ) ), esc_url( home_url( '/' ) ),
esc_attr( $size ) esc_attr( $size )
); );
} }
/** /**
* Filter the Site Logo output. * Filter the custom logo output.
* *
* @since 4.5.0 * @since 4.5.0
* *
* @param string $html Site Logo HTML output. * @param string $html Custom logo HTML output.
* @param string $size Size specified in add_theme_support declaration, or 'thumbnail' default. * @param string $size Size specified in add_theme_support declaration, or 'thumbnail' default.
*/ */
return apply_filters( 'get_the_site_logo', $html, $size ); return apply_filters( 'get_custom_logo', $html, $size );
} }
/** /**
* Displays a Site Logo, linked to home. * Displays a custom logo, linked to home.
* *
* @since 4.5.0 * @since 4.5.0
* *
* @param int $blog_id Optional. ID of the blog in question. Default current blog. * @param int $blog_id Optional. ID of the blog in question. Default current blog.
*/ */
function the_site_logo( $blog_id = 0 ) { function the_custom_logo( $blog_id = 0 ) {
echo get_the_site_logo( $blog_id ); echo get_custom_logo( $blog_id );
} }
/** /**

View File

@ -224,9 +224,9 @@
}); });
/** /**
* Site Logo * Custom Logo
* *
* The site logo setting only contains the attachment ID. To avoid having to send an AJAX request to get more * The custom logo setting only contains the attachment ID. To avoid having to send an AJAX request to get more
* data, we send a separate message with the attachment data we get from the Customizer's media modal. * data, we send a separate message with the attachment data we get from the Customizer's media modal.
* Therefore first callback handles only the event of a new logo being selected. * Therefore first callback handles only the event of a new logo being selected.
* *
@ -234,8 +234,8 @@
* *
* @since 4.5.0 * @since 4.5.0
*/ */
api.preview.bind( 'site-logo-attachment-data', function( attachment ) { api.preview.bind( 'custom-logo-attachment-data', function( attachment ) {
var $logo = $( '.site-logo' ), var $logo = $( '.custom-logo' ),
size = $logo.data( 'size' ), size = $logo.data( 'size' ),
srcset = []; srcset = [];
@ -255,27 +255,25 @@
srcset: srcset srcset: srcset
} ); } );
$( '.site-logo-link' ).show(); $( '.custom-logo-link' ).show();
$( 'body' ).addClass( 'wp-site-logo' );
} ); } );
api( 'site_logo', function( setting ) { api( 'custom_logo', function( setting ) {
setting.bind( function( newValue ) { setting.bind( function( newValue ) {
if ( ! newValue ) { if ( ! newValue ) {
$( '.site-logo-link' ).hide(); $( '.custom-logo-link' ).hide();
$( 'body' ).removeClass( 'wp-site-logo' );
} }
} ); } );
// Focus on the control when the logo is clicked, if there is no site_logo partial. // Focus on the control when the logo is clicked, if there is no custom_logo partial.
if ( ! api.selectiveRefresh || ! api.selectiveRefresh.partial.has( 'site_logo' ) ) { if ( ! api.selectiveRefresh || ! api.selectiveRefresh.partial.has( 'custom_logo' ) ) {
$( document.body ).on( 'click', '.site-logo-link', function( e ) { $( document.body ).on( 'click', '.custom-logo-link', function( e ) {
if ( ! e.shiftKey ) { if ( ! e.shiftKey ) {
return; return;
} }
api.preview.send( 'focus-control-for-setting', 'site_logo' ); api.preview.send( 'focus-control-for-setting', 'custom_logo' );
} ); } );
$( '.site-logo-link' ).attr( 'title', api.settings.l10n.shiftClickToEdit ); $( '.custom-logo-link' ).attr( 'title', api.settings.l10n.shiftClickToEdit );
} }
} ); } );

View File

@ -1 +1 @@
!function(a,b){var c,d=wp.customize;c=function(a,b,c){var d;return function(){var e=arguments;c=c||this,clearTimeout(d),d=setTimeout(function(){d=null,a.apply(c,e)},b)}},d.Preview=d.Messenger.extend({initialize:function(a,e){var f=this;d.Messenger.prototype.initialize.call(this,a,e),this.body=b(document.body),this.body.on("click.preview","a",function(a){var c,d;c=b(this),d="#"===c.attr("href").substr(0,1),a.preventDefault(),d&&"#"!==c.attr("href")&&b(c.attr("href")).each(function(){this.scrollIntoView()}),a.shiftKey||d||(f.send("scroll",0),f.send("url",c.prop("href")))}),this.body.on("submit.preview","form",function(a){a.preventDefault()}),this.window=b(window),this.window.on("scroll.preview",c(function(){f.send("scroll",f.window.scrollTop())},200)),this.bind("scroll",function(a){f.window.scrollTop(a)})}}),b(function(){var a,c;d.settings=window._wpCustomizeSettings,d.settings&&(d.preview=new d.Preview({url:window.location.href,channel:d.settings.channel}),c=function(a,b,c){var e=d(a);e?e.set(b):(c=c||!1,e=d.create(a,b,{id:a}),c&&(e._dirty=!0))},d.preview.bind("settings",function(a){b.each(a,c)}),d.preview.trigger("settings",d.settings.values),b.each(d.settings._dirty,function(a,b){var c=d(b);c&&(c._dirty=!0)}),d.preview.bind("setting",function(a){var b=!0;c.apply(null,a.concat(b))}),d.preview.bind("sync",function(a){b.each(a,function(a,b){d.preview.trigger(a,b)}),d.preview.send("synced")}),d.preview.bind("active",function(){d.preview.send("nonce",d.settings.nonce),d.preview.send("documentTitle",document.title)}),d.preview.bind("saved",function(a){d.trigger("saved",a)}),d.bind("saved",function(){d.each(function(a){a._dirty=!1})}),d.preview.bind("nonce-refresh",function(a){b.extend(d.settings.nonce,a)}),d.preview.send("ready",{activePanels:d.settings.activePanels,activeSections:d.settings.activeSections,activeControls:d.settings.activeControls}),d.preview.bind("loading-initiated",function(){b("body").addClass("wp-customizer-unloading")}),d.preview.bind("loading-failed",function(){b("body").removeClass("wp-customizer-unloading")}),a=b.map(["color","image","position_x","repeat","attachment"],function(a){return"background_"+a}),d.when.apply(d,a).done(function(a,c,d,e,f){var g,h=b(document.body),i=b("head"),j=b("#custom-background-css");g=function(){var g="";h.toggleClass("custom-background",!(!a()&&!c())),a()&&(g+="background-color: "+a()+";"),c()&&(g+='background-image: url("'+c()+'");',g+="background-position: top "+d()+";",g+="background-repeat: "+e()+";",g+="background-attachment: "+f()+";"),j.remove(),j=b('<style type="text/css" id="custom-background-css">body.custom-background { '+g+" }</style>").appendTo(i)},b.each(arguments,function(){this.bind(g)})}),d.preview.bind("site-logo-attachment-data",function(a){var c=b(".site-logo"),d=c.data("size"),e=[];a.sizes[d]||(d="full"),_.each(a.sizes,function(a){e.push(a.url+" "+a.width+"w")}),c.attr({height:a.sizes[d].height,width:a.sizes[d].width,src:a.sizes[d].url,srcset:e}),b(".site-logo-link").show(),b("body").addClass("wp-site-logo")}),d("site_logo",function(a){a.bind(function(a){a||(b(".site-logo-link").hide(),b("body").removeClass("wp-site-logo"))}),d.selectiveRefresh&&d.selectiveRefresh.partial.has("site_logo")||(b(document.body).on("click",".site-logo-link",function(a){a.shiftKey&&d.preview.send("focus-control-for-setting","site_logo")}),b(".site-logo-link").attr("title",d.settings.l10n.shiftClickToEdit))}),d.trigger("preview-ready"))})}(wp,jQuery); !function(a,b){var c,d=wp.customize;c=function(a,b,c){var d;return function(){var e=arguments;c=c||this,clearTimeout(d),d=setTimeout(function(){d=null,a.apply(c,e)},b)}},d.Preview=d.Messenger.extend({initialize:function(a,e){var f=this;d.Messenger.prototype.initialize.call(this,a,e),this.body=b(document.body),this.body.on("click.preview","a",function(a){var c,d;c=b(this),d="#"===c.attr("href").substr(0,1),a.preventDefault(),d&&"#"!==c.attr("href")&&b(c.attr("href")).each(function(){this.scrollIntoView()}),a.shiftKey||d||(f.send("scroll",0),f.send("url",c.prop("href")))}),this.body.on("submit.preview","form",function(a){a.preventDefault()}),this.window=b(window),this.window.on("scroll.preview",c(function(){f.send("scroll",f.window.scrollTop())},200)),this.bind("scroll",function(a){f.window.scrollTop(a)})}}),b(function(){var a,c;d.settings=window._wpCustomizeSettings,d.settings&&(d.preview=new d.Preview({url:window.location.href,channel:d.settings.channel}),c=function(a,b,c){var e=d(a);e?e.set(b):(c=c||!1,e=d.create(a,b,{id:a}),c&&(e._dirty=!0))},d.preview.bind("settings",function(a){b.each(a,c)}),d.preview.trigger("settings",d.settings.values),b.each(d.settings._dirty,function(a,b){var c=d(b);c&&(c._dirty=!0)}),d.preview.bind("setting",function(a){var b=!0;c.apply(null,a.concat(b))}),d.preview.bind("sync",function(a){b.each(a,function(a,b){d.preview.trigger(a,b)}),d.preview.send("synced")}),d.preview.bind("active",function(){d.preview.send("nonce",d.settings.nonce),d.preview.send("documentTitle",document.title)}),d.preview.bind("saved",function(a){d.trigger("saved",a)}),d.bind("saved",function(){d.each(function(a){a._dirty=!1})}),d.preview.bind("nonce-refresh",function(a){b.extend(d.settings.nonce,a)}),d.preview.send("ready",{activePanels:d.settings.activePanels,activeSections:d.settings.activeSections,activeControls:d.settings.activeControls}),d.preview.bind("loading-initiated",function(){b("body").addClass("wp-customizer-unloading")}),d.preview.bind("loading-failed",function(){b("body").removeClass("wp-customizer-unloading")}),a=b.map(["color","image","position_x","repeat","attachment"],function(a){return"background_"+a}),d.when.apply(d,a).done(function(a,c,d,e,f){var g,h=b(document.body),i=b("head"),j=b("#custom-background-css");g=function(){var g="";h.toggleClass("custom-background",!(!a()&&!c())),a()&&(g+="background-color: "+a()+";"),c()&&(g+='background-image: url("'+c()+'");',g+="background-position: top "+d()+";",g+="background-repeat: "+e()+";",g+="background-attachment: "+f()+";"),j.remove(),j=b('<style type="text/css" id="custom-background-css">body.custom-background { '+g+" }</style>").appendTo(i)},b.each(arguments,function(){this.bind(g)})}),d.preview.bind("custom-logo-attachment-data",function(a){var c=b(".custom-logo"),d=c.data("size"),e=[];a.sizes[d]||(d="full"),_.each(a.sizes,function(a){e.push(a.url+" "+a.width+"w")}),c.attr({height:a.sizes[d].height,width:a.sizes[d].width,src:a.sizes[d].url,srcset:e}),b(".custom-logo-link").show()}),d("custom_logo",function(a){a.bind(function(a){a||b(".custom-logo-link").hide()}),d.selectiveRefresh&&d.selectiveRefresh.partial.has("custom_logo")||(b(document.body).on("click",".custom-logo-link",function(a){a.shiftKey&&d.preview.send("focus-control-for-setting","custom_logo")}),b(".custom-logo-link").attr("title",d.settings.l10n.shiftClickToEdit))}),d.trigger("preview-ready"))})}(wp,jQuery);

View File

@ -706,10 +706,6 @@ function get_body_class( $class = '' ) {
if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() )
$classes[] = 'custom-background'; $classes[] = 'custom-background';
if ( has_site_logo() ) {
$classes[] = 'wp-site-logo';
}
$page = $wp_query->get( 'page' ); $page = $wp_query->get( 'page' );
if ( ! $page || $page < 2 ) if ( ! $page || $page < 2 )

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.5-beta2-36836'; $wp_version = '4.5-beta2-36837';
/** /**
* 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.