WP_Customize_Manager::remove_section PHP Method

remove_section() public method

Remove a customize section.
Since: 3.4.0
public remove_section ( string $id )
$id string Section ID.
    public function remove_section($id)
    {
        unset($this->sections[$id]);
    }

Usage Example

Example #1
1
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function tesseract_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    $wp_customize->add_panel('tesseract_general_options', array('priority' => 3, 'capability' => 'edit_theme_options', 'title' => 'General'));
    $wp_customize->add_panel('tesseract_header_options', array('priority' => 4, 'capability' => 'edit_theme_options', 'title' => 'Header Options'));
    $wp_customize->add_panel('tesseract_footer_options', array('priority' => 5, 'capability' => 'edit_theme_options', 'title' => 'Footer Options'));
    $wp_customize->add_panel('tesseract_layout', array('priority' => 7, 'capability' => 'edit_theme_options', 'title' => 'Layout Options'));
    $wp_customize->add_panel('tesseract_social', array('priority' => 8, 'capability' => 'edit_theme_options', 'title' => 'Social'));
    $wp_customize->get_section('title_tagline')->panel = 'tesseract_header_options';
    $wp_customize->get_section('title_tagline')->priority = 3;
    if ($wp_customize->get_section('static_front_page')) {
        $wp_customize->get_section('static_front_page')->panel = 'tesseract_general_options';
        $wp_customize->get_section('static_front_page')->priority = 4;
    }
    $wp_customize->get_section('background_image')->panel = 'tesseract_general_options';
    $wp_customize->get_section('background_image')->priority = 2;
    $wp_customize->get_section('colors')->panel = 'tesseract_general_options';
    $wp_customize->get_section('colors')->title = __('Background Color', 'tesseract');
    $wp_customize->get_section('colors')->priority = 1;
    $wp_customize->get_control('background_color')->label = __('Choose a background color', 'tesseract');
    $wp_customize->get_control('background_color')->description = __('(This is only for the site\'s generic background color. You can define header and footer background colors in the Header Options and Footer Options respectively.)', 'tesseract');
    $wp_customize->remove_section('header_image');
    $wp_customize->remove_section('nav');
    $wp_customize->remove_control('header_textcolor');
    require get_template_directory() . '/inc/sections/header-colors.php';
    require get_template_directory() . '/inc/sections/header-logo.php';
    require get_template_directory() . '/inc/sections/header-size.php';
    require get_template_directory() . '/inc/sections/header-menu.php';
    require get_template_directory() . '/inc/sections/header-content.php';
    require get_template_directory() . '/inc/sections/mobile-menu.php';
    require get_template_directory() . '/inc/sections/social/account01.php';
    require get_template_directory() . '/inc/sections/social/account02.php';
    require get_template_directory() . '/inc/sections/social/account03.php';
    require get_template_directory() . '/inc/sections/social/account04.php';
    require get_template_directory() . '/inc/sections/social/account05.php';
    require get_template_directory() . '/inc/sections/social/account06.php';
    require get_template_directory() . '/inc/sections/social/account07.php';
    require get_template_directory() . '/inc/sections/social/account08.php';
    require get_template_directory() . '/inc/sections/social/account09.php';
    require get_template_directory() . '/inc/sections/social/account10.php';
    require get_template_directory() . '/inc/sections/blog.php';
    require get_template_directory() . '/inc/sections/search-results.php';
    require get_template_directory() . '/inc/sections/footer-colors.php';
    require get_template_directory() . '/inc/sections/footer-size.php';
    require get_template_directory() . '/inc/sections/footer-logo.php';
    require get_template_directory() . '/inc/sections/footer-content.php';
    require get_template_directory() . '/inc/sections/woocommerce.php';
    //if ( $wp_customize->is_preview() && ! is_admin() )
    //add_action( 'wp_footer', 'tesseract_customize_preview', 21);
}
All Usage Examples Of WP_Customize_Manager::remove_section
WP_Customize_Manager