Make WordPress Core


Ignore:
Timestamp:
03/03/2016 07:55:15 PM (8 years ago)
Author:
obenland
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r36802 r36837  
    840840
    841841/**
    842  * Whether the site has a Site Logo.
     842 * Whether the site has a custom logo.
    843843 *
    844844 * @since 4.5.0
    845845 *
    846846 * @param int $blog_id Optional. ID of the blog in question. Default current blog.
    847  * @return bool Whether the site has a site logo or not.
    848  */
    849 function has_site_logo( $blog_id = 0 ) {
     847 * @return bool Whether the site has a custom logo or not.
     848 */
     849function has_custom_logo( $blog_id = 0 ) {
    850850    if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) {
    851851        switch_to_blog( $blog_id );
    852852    }
    853853
    854     $site_logo_id = get_theme_mod( 'site_logo' );
     854    $custom_logo_id = get_theme_mod( 'custom_logo' );
    855855
    856856    if ( is_multisite() && ms_is_switched() ) {
     
    858858    }
    859859
    860     return (bool) $site_logo_id;
    861 }
    862 
    863 /**
    864  * Returns a Site Logo, linked to home.
     860    return (bool) $custom_logo_id;
     861}
     862
     863/**
     864 * Returns a custom logo, linked to home.
    865865 *
    866866 * @since 4.5.0
    867867 *
    868868 * @param int $blog_id Optional. ID of the blog in question. Default current blog.
    869  * @return string Site logo markup.
    870  */
    871 function get_the_site_logo( $blog_id = 0 ) {
     869 * @return string Custom logo markup.
     870 */
     871function get_custom_logo( $blog_id = 0 ) {
    872872    $html = '';
    873873
     
    876876    }
    877877
    878     $site_logo_id = get_theme_mod( 'site_logo' );
     878    $custom_logo_id = get_theme_mod( 'custom_logo' );
    879879
    880880    if ( is_multisite() && ms_is_switched() ) {
    881881        restore_current_blog();
    882882    }
    883     $size = get_theme_support( 'site-logo' );
     883    $size = get_theme_support( 'custom-logo' );
    884884    $size = $size[0]['size'];
    885885
    886886    // We have a logo. Logo is go.
    887     if ( $site_logo_id ) {
    888         $html = sprintf( '<a href="%1$s" class="site-logo-link" rel="home" itemprop="url">%2$s</a>',
     887    if ( $custom_logo_id ) {
     888        $html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
    889889            esc_url( home_url( '/' ) ),
    890             wp_get_attachment_image( $site_logo_id, $size, false, array(
    891                 'class'     => "site-logo attachment-$size",
     890            wp_get_attachment_image( $custom_logo_id, $size, false, array(
     891                'class'     => "custom-logo attachment-$size",
    892892                'data-size' => $size,
    893893                'itemprop'  => 'logo',
     
    898898    // If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview).
    899899    elseif ( is_customize_preview() ) {
    900         $html = sprintf( '<a href="%1$s" class="site-logo-link" style="display:none;"><img class="site-logo" data-size="%2$s" /></a>',
     900        $html = sprintf( '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo" data-size="%2$s" /></a>',
    901901            esc_url( home_url( '/' ) ),
    902902            esc_attr( $size )
     
    905905
    906906    /**
    907      * Filter the Site Logo output.
     907     * Filter the custom logo output.
    908908     *
    909909     * @since 4.5.0
    910910     *
    911      * @param string $html Site Logo HTML output.
     911     * @param string $html Custom logo HTML output.
    912912     * @param string $size Size specified in add_theme_support declaration, or 'thumbnail' default.
    913913     */
    914     return apply_filters( 'get_the_site_logo', $html, $size );
    915 }
    916 
    917 /**
    918  * Displays a Site Logo, linked to home.
     914    return apply_filters( 'get_custom_logo', $html, $size );
     915}
     916
     917/**
     918 * Displays a custom logo, linked to home.
    919919 *
    920920 * @since 4.5.0
     
    922922 * @param int $blog_id Optional. ID of the blog in question. Default current blog.
    923923 */
    924 function the_site_logo( $blog_id = 0 ) {
    925     echo get_the_site_logo( $blog_id );
     924function the_custom_logo( $blog_id = 0 ) {
     925    echo get_custom_logo( $blog_id );
    926926}
    927927
Note: See TracChangeset for help on using the changeset viewer.