mirror of
https://github.com/woocommerce/storefront.git
synced 2025-08-21 04:11:59 +08:00
Conditionally display homepage template
This commit is contained in:
parent
3f01e9ddcf
commit
35a575c4ab
1 changed files with 18 additions and 0 deletions
|
@ -243,6 +243,7 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
|
||||||
'section' => 'storefront_typography',
|
'section' => 'storefront_typography',
|
||||||
'settings' => 'storefront_hero_heading_color',
|
'settings' => 'storefront_hero_heading_color',
|
||||||
'priority' => 50,
|
'priority' => 50,
|
||||||
|
'active_callback' => array( $this, 'is_homepage_template' ),
|
||||||
) ) );
|
) ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -258,6 +259,7 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
|
||||||
'section' => 'storefront_typography',
|
'section' => 'storefront_typography',
|
||||||
'settings' => 'storefront_hero_text_color',
|
'settings' => 'storefront_hero_text_color',
|
||||||
'priority' => 60,
|
'priority' => 60,
|
||||||
|
'active_callback' => array( $this, 'is_homepage_template' ),
|
||||||
) ) );
|
) ) );
|
||||||
|
|
||||||
$wp_customize->add_control( new Arbitrary_Storefront_Control( $wp_customize, 'storefront_header_image_heading', array(
|
$wp_customize->add_control( new Arbitrary_Storefront_Control( $wp_customize, 'storefront_header_image_heading', array(
|
||||||
|
@ -976,6 +978,22 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
|
||||||
public function get_site_description() {
|
public function get_site_description() {
|
||||||
return get_bloginfo( 'description', 'display' );
|
return get_bloginfo( 'description', 'display' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if current page is using the Homepage template.
|
||||||
|
*
|
||||||
|
* @since 2.3.0
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function is_homepage_template() {
|
||||||
|
$template = get_post_meta( get_the_ID(), '_wp_page_template', true );
|
||||||
|
|
||||||
|
if ( ! $template || 'template-homepage.php' !== $template ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue