mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@36837 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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
|
||||
*
|
||||
* @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() ) {
|
||||
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() ) {
|
||||
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
|
||||
*
|
||||
* @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 = '';
|
||||
|
||||
if ( is_multisite() && (int) $blog_id !== get_current_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() ) {
|
||||
restore_current_blog();
|
||||
}
|
||||
$size = get_theme_support( 'site-logo' );
|
||||
$size = get_theme_support( 'custom-logo' );
|
||||
$size = $size[0]['size'];
|
||||
|
||||
// We have a logo. Logo is go.
|
||||
if ( $site_logo_id ) {
|
||||
$html = sprintf( '<a href="%1$s" class="site-logo-link" rel="home" itemprop="url">%2$s</a>',
|
||||
if ( $custom_logo_id ) {
|
||||
$html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
|
||||
esc_url( home_url( '/' ) ),
|
||||
wp_get_attachment_image( $site_logo_id, $size, false, array(
|
||||
'class' => "site-logo attachment-$size",
|
||||
wp_get_attachment_image( $custom_logo_id, $size, false, array(
|
||||
'class' => "custom-logo attachment-$size",
|
||||
'data-size' => $size,
|
||||
'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).
|
||||
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_attr( $size )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the Site Logo output.
|
||||
* Filter the custom logo output.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param int $blog_id Optional. ID of the blog in question. Default current blog.
|
||||
*/
|
||||
function the_site_logo( $blog_id = 0 ) {
|
||||
echo get_the_site_logo( $blog_id );
|
||||
function the_custom_logo( $blog_id = 0 ) {
|
||||
echo get_custom_logo( $blog_id );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user