Changeset 36837 for trunk/src/wp-includes/general-template.php
- Timestamp:
- 03/03/2016 07:55:15 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r36802 r36837 840 840 841 841 /** 842 * Whether the site has a Site Logo.842 * Whether the site has a custom logo. 843 843 * 844 844 * @since 4.5.0 845 845 * 846 846 * @param int $blog_id Optional. ID of the blog in question. Default current blog. 847 * @return bool Whether the site has a sitelogo or not.848 */ 849 function has_ site_logo( $blog_id = 0 ) {847 * @return bool Whether the site has a custom logo or not. 848 */ 849 function has_custom_logo( $blog_id = 0 ) { 850 850 if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) { 851 851 switch_to_blog( $blog_id ); 852 852 } 853 853 854 $ site_logo_id = get_theme_mod( 'site_logo' );854 $custom_logo_id = get_theme_mod( 'custom_logo' ); 855 855 856 856 if ( is_multisite() && ms_is_switched() ) { … … 858 858 } 859 859 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. 865 865 * 866 866 * @since 4.5.0 867 867 * 868 868 * @param int $blog_id Optional. ID of the blog in question. Default current blog. 869 * @return string Sitelogo markup.870 */ 871 function get_ the_site_logo( $blog_id = 0 ) {869 * @return string Custom logo markup. 870 */ 871 function get_custom_logo( $blog_id = 0 ) { 872 872 $html = ''; 873 873 … … 876 876 } 877 877 878 $ site_logo_id = get_theme_mod( 'site_logo' );878 $custom_logo_id = get_theme_mod( 'custom_logo' ); 879 879 880 880 if ( is_multisite() && ms_is_switched() ) { 881 881 restore_current_blog(); 882 882 } 883 $size = get_theme_support( ' site-logo' );883 $size = get_theme_support( 'custom-logo' ); 884 884 $size = $size[0]['size']; 885 885 886 886 // 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>', 889 889 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", 892 892 'data-size' => $size, 893 893 'itemprop' => 'logo', … … 898 898 // If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview). 899 899 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>', 901 901 esc_url( home_url( '/' ) ), 902 902 esc_attr( $size ) … … 905 905 906 906 /** 907 * Filter the Site Logo output.907 * Filter the custom logo output. 908 908 * 909 909 * @since 4.5.0 910 910 * 911 * @param string $html Site Logo HTML output.911 * @param string $html Custom logo HTML output. 912 912 * @param string $size Size specified in add_theme_support declaration, or 'thumbnail' default. 913 913 */ 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. 919 919 * 920 920 * @since 4.5.0 … … 922 922 * @param int $blog_id Optional. ID of the blog in question. Default current blog. 923 923 */ 924 function the_ site_logo( $blog_id = 0 ) {925 echo get_ the_site_logo( $blog_id );924 function the_custom_logo( $blog_id = 0 ) { 925 echo get_custom_logo( $blog_id ); 926 926 } 927 927
Note: See TracChangeset
for help on using the changeset viewer.