custom logo selective refresh

This commit is contained in:
James Koster 2016-08-03 09:49:16 +01:00
parent 279147af4e
commit 71bc5b3961
2 changed files with 37 additions and 19 deletions

View file

@ -144,8 +144,15 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
$wp_customize->get_section( 'header_image' )->priority = 25;
// Selective refresh.
$wp_customize->selective_refresh->add_partial( 'custom_logo', array(
'selector' => '.site-branding',
'render_callback' => function() {
storefront_site_title_or_logo();
},
) );
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.site-title a',
'selector' => '.site-title.beta a',
'render_callback' => function() {
bloginfo( 'name' );
},

View file

@ -153,7 +153,7 @@ if ( ! function_exists( 'storefront_header_widget_region' ) ) {
if ( ! function_exists( 'storefront_site_branding' ) ) {
/**
* Display Site Branding
* Site branding wrapper and display
*
* @since 1.0.0
* @return void
@ -161,7 +161,20 @@ if ( ! function_exists( 'storefront_site_branding' ) ) {
function storefront_site_branding() {
?>
<div class="site-branding">
<?php storefront_site_title_or_logo(); ?>
</div>
<?php
}
}
if ( ! function_exists( 'storefront_site_title_or_logo' ) ) {
/**
* Display the site title or logo
*
* @since 2.1.0
* @return void
*/
function storefront_site_title_or_logo() {
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
$logo = get_custom_logo();
@ -177,9 +190,7 @@ if ( ! function_exists( 'storefront_site_branding' ) ) {
<p class="site-description"><?php echo bloginfo( 'description' ); ?></p>
<?php
}
} ?>
</div>
<?php
}
}
}