mirror of
https://github.com/woocommerce/storefront.git
synced 2025-08-21 04:11:59 +08:00
custom logo selective refresh
This commit is contained in:
parent
279147af4e
commit
71bc5b3961
2 changed files with 37 additions and 19 deletions
|
@ -144,8 +144,15 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
|
||||||
$wp_customize->get_section( 'header_image' )->priority = 25;
|
$wp_customize->get_section( 'header_image' )->priority = 25;
|
||||||
|
|
||||||
// Selective refresh.
|
// 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(
|
$wp_customize->selective_refresh->add_partial( 'blogname', array(
|
||||||
'selector' => '.site-title a',
|
'selector' => '.site-title.beta a',
|
||||||
'render_callback' => function() {
|
'render_callback' => function() {
|
||||||
bloginfo( 'name' );
|
bloginfo( 'name' );
|
||||||
},
|
},
|
||||||
|
|
|
@ -153,7 +153,7 @@ if ( ! function_exists( 'storefront_header_widget_region' ) ) {
|
||||||
|
|
||||||
if ( ! function_exists( 'storefront_site_branding' ) ) {
|
if ( ! function_exists( 'storefront_site_branding' ) ) {
|
||||||
/**
|
/**
|
||||||
* Display Site Branding
|
* Site branding wrapper and display
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @return void
|
* @return void
|
||||||
|
@ -161,7 +161,20 @@ if ( ! function_exists( 'storefront_site_branding' ) ) {
|
||||||
function storefront_site_branding() {
|
function storefront_site_branding() {
|
||||||
?>
|
?>
|
||||||
<div class="site-branding">
|
<div class="site-branding">
|
||||||
|
<?php storefront_site_title_or_logo(); ?>
|
||||||
|
</div>
|
||||||
<?php
|
<?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() ) {
|
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
|
||||||
$logo = get_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>
|
<p class="site-description"><?php echo bloginfo( 'description' ); ?></p>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
} ?>
|
}
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue