Customizer: Replicate behavior from options-reading.php and hide front page options if there are no pages.
props Clorith. fixes #27630. git-svn-id: https://develop.svn.wordpress.org/trunk@31234 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
68283f5fb3
commit
2b4099c6bd
@ -1199,53 +1199,56 @@ final class WP_Customize_Manager {
|
|||||||
/* Static Front Page */
|
/* Static Front Page */
|
||||||
// #WP19627
|
// #WP19627
|
||||||
|
|
||||||
$this->add_section( 'static_front_page', array(
|
// Replicate behavior from options-reading.php and hide front page options if there are no pages
|
||||||
'title' => __( 'Static Front Page' ),
|
if ( get_pages() ) {
|
||||||
// 'theme_supports' => 'static-front-page',
|
$this->add_section( 'static_front_page', array(
|
||||||
'priority' => 120,
|
'title' => __( 'Static Front Page' ),
|
||||||
'description' => __( 'Your theme supports a static front page.' ),
|
// 'theme_supports' => 'static-front-page',
|
||||||
) );
|
'priority' => 120,
|
||||||
|
'description' => __( 'Your theme supports a static front page.' ),
|
||||||
|
) );
|
||||||
|
|
||||||
$this->add_setting( 'show_on_front', array(
|
$this->add_setting( 'show_on_front', array(
|
||||||
'default' => get_option( 'show_on_front' ),
|
'default' => get_option( 'show_on_front' ),
|
||||||
'capability' => 'manage_options',
|
'capability' => 'manage_options',
|
||||||
'type' => 'option',
|
'type' => 'option',
|
||||||
// 'theme_supports' => 'static-front-page',
|
// 'theme_supports' => 'static-front-page',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->add_control( 'show_on_front', array(
|
$this->add_control( 'show_on_front', array(
|
||||||
'label' => __( 'Front page displays' ),
|
'label' => __( 'Front page displays' ),
|
||||||
'section' => 'static_front_page',
|
'section' => 'static_front_page',
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
'choices' => array(
|
'choices' => array(
|
||||||
'posts' => __( 'Your latest posts' ),
|
'posts' => __( 'Your latest posts' ),
|
||||||
'page' => __( 'A static page' ),
|
'page' => __( 'A static page' ),
|
||||||
),
|
),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->add_setting( 'page_on_front', array(
|
$this->add_setting( 'page_on_front', array(
|
||||||
'type' => 'option',
|
'type' => 'option',
|
||||||
'capability' => 'manage_options',
|
'capability' => 'manage_options',
|
||||||
// 'theme_supports' => 'static-front-page',
|
// 'theme_supports' => 'static-front-page',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->add_control( 'page_on_front', array(
|
$this->add_control( 'page_on_front', array(
|
||||||
'label' => __( 'Front page' ),
|
'label' => __( 'Front page' ),
|
||||||
'section' => 'static_front_page',
|
'section' => 'static_front_page',
|
||||||
'type' => 'dropdown-pages',
|
'type' => 'dropdown-pages',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->add_setting( 'page_for_posts', array(
|
$this->add_setting( 'page_for_posts', array(
|
||||||
'type' => 'option',
|
'type' => 'option',
|
||||||
'capability' => 'manage_options',
|
'capability' => 'manage_options',
|
||||||
// 'theme_supports' => 'static-front-page',
|
// 'theme_supports' => 'static-front-page',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$this->add_control( 'page_for_posts', array(
|
$this->add_control( 'page_for_posts', array(
|
||||||
'label' => __( 'Posts page' ),
|
'label' => __( 'Posts page' ),
|
||||||
'section' => 'static_front_page',
|
'section' => 'static_front_page',
|
||||||
'type' => 'dropdown-pages',
|
'type' => 'dropdown-pages',
|
||||||
) );
|
) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user