From 7d2ec003da2fc2e0c67c224d72be2802a7fc040d Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 18 Jan 2015 06:01:24 +0000 Subject: [PATCH] Customizer: Replicate behavior from options-reading.php and hide front page options if there are no pages. props Clorith. fixes #27630. Built from https://develop.svn.wordpress.org/trunk@31234 git-svn-id: http://core.svn.wordpress.org/trunk@31215 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-manager.php | 85 +++++++++++----------- wp-includes/version.php | 2 +- 2 files changed, 45 insertions(+), 42 deletions(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index ccf58358ec..b695271d61 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -1199,53 +1199,56 @@ final class WP_Customize_Manager { /* Static Front Page */ // #WP19627 - $this->add_section( 'static_front_page', array( - 'title' => __( 'Static Front Page' ), - // 'theme_supports' => 'static-front-page', - 'priority' => 120, - 'description' => __( 'Your theme supports a static front page.' ), - ) ); + // Replicate behavior from options-reading.php and hide front page options if there are no pages + if ( get_pages() ) { + $this->add_section( 'static_front_page', array( + 'title' => __( '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( - 'default' => get_option( 'show_on_front' ), - 'capability' => 'manage_options', - 'type' => 'option', - // 'theme_supports' => 'static-front-page', - ) ); + $this->add_setting( 'show_on_front', array( + 'default' => get_option( 'show_on_front' ), + 'capability' => 'manage_options', + 'type' => 'option', + // 'theme_supports' => 'static-front-page', + ) ); - $this->add_control( 'show_on_front', array( - 'label' => __( 'Front page displays' ), - 'section' => 'static_front_page', - 'type' => 'radio', - 'choices' => array( - 'posts' => __( 'Your latest posts' ), - 'page' => __( 'A static page' ), - ), - ) ); + $this->add_control( 'show_on_front', array( + 'label' => __( 'Front page displays' ), + 'section' => 'static_front_page', + 'type' => 'radio', + 'choices' => array( + 'posts' => __( 'Your latest posts' ), + 'page' => __( 'A static page' ), + ), + ) ); - $this->add_setting( 'page_on_front', array( - 'type' => 'option', - 'capability' => 'manage_options', - // 'theme_supports' => 'static-front-page', - ) ); + $this->add_setting( 'page_on_front', array( + 'type' => 'option', + 'capability' => 'manage_options', + // 'theme_supports' => 'static-front-page', + ) ); - $this->add_control( 'page_on_front', array( - 'label' => __( 'Front page' ), - 'section' => 'static_front_page', - 'type' => 'dropdown-pages', - ) ); + $this->add_control( 'page_on_front', array( + 'label' => __( 'Front page' ), + 'section' => 'static_front_page', + 'type' => 'dropdown-pages', + ) ); - $this->add_setting( 'page_for_posts', array( - 'type' => 'option', - 'capability' => 'manage_options', - // 'theme_supports' => 'static-front-page', - ) ); + $this->add_setting( 'page_for_posts', array( + 'type' => 'option', + 'capability' => 'manage_options', + // 'theme_supports' => 'static-front-page', + ) ); - $this->add_control( 'page_for_posts', array( - 'label' => __( 'Posts page' ), - 'section' => 'static_front_page', - 'type' => 'dropdown-pages', - ) ); + $this->add_control( 'page_for_posts', array( + 'label' => __( 'Posts page' ), + 'section' => 'static_front_page', + 'type' => 'dropdown-pages', + ) ); + } } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index e46153852a..1f449b697e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31233'; +$wp_version = '4.2-alpha-31234'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.