remove_panel() 공개 메소드

Remove a customize panel.
부터: 4.0.0
public remove_panel ( string $id )
$id string Panel ID to remove.
예제 #1
0
 /**
  * Removes all non-AMP sections and panels.
  *
  * Provides a clean, standalone instance-like experience by removing all non-AMP registered panels and sections.
  *
  * @since 0.4
  * @access private
  */
 private function _unregister_core_ui()
 {
     $panels = $this->wp_customize->panels();
     $sections = $this->wp_customize->sections();
     foreach ($panels as $panel_id => $object) {
         $this->wp_customize->remove_panel($panel_id);
     }
     foreach ($sections as $section_id => $object) {
         $this->wp_customize->remove_section($section_id);
     }
 }
 /**
  * Handle a panel entry
  *
  * @param $id
  * @param array $data
  * @param array|null $sections
  */
 public function setPanel($id, array $data, array $sections = null)
 {
     $panel_data = $this->getPanelData($data);
     if (is_null($sections) && isset($data['sections'])) {
         $sections = $data['sections'];
     }
     $item = $this->customizer->get_panel($id);
     if ($item) {
         foreach ($data as $var => $val) {
             if (array_key_exists($var, $panel_data)) {
                 $item->{$var} = $val;
             }
         }
         if (isset($data['delete']) && $data['delete'] === true) {
             $this->customizer->remove_panel($id);
         }
     } else {
         $this->customizer->add_panel(new WP_Customize_Panel($this->customizer, $id, $panel_data));
     }
     if (!is_null($sections)) {
         $sections['object'] = 'sections';
         $sections['panel'] = $id;
         $this->processData($sections);
     }
 }
예제 #3
0
/**
 * Adding different options
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function supermag_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    /*saved options*/
    $options = supermag_get_theme_options();
    /*defaults options*/
    $defaults = supermag_get_default_theme_options();
    /*
     * file for customizer custom controls classes
     */
    $supermag_custom_controls_file_path = supermag_file_directory('acmethemes/customizer/custom-controls.php');
    require $supermag_custom_controls_file_path;
    /*
     * file for feature panel of home page
     */
    $supermag_customizer_feature_option_file_path = supermag_file_directory('acmethemes/customizer/feature-section/feature-panel.php');
    require $supermag_customizer_feature_option_file_path;
    /*
     * file for header panel
     */
    $supermag_customizer_header_options_file_path = supermag_file_directory('acmethemes/customizer/header-options/header-panel.php');
    require $supermag_customizer_header_options_file_path;
    /*
     * file for customizer footer section
     */
    $supermag_customizer_footer_options_file_path = supermag_file_directory('acmethemes/customizer/footer-section/footer-section.php');
    require $supermag_customizer_footer_options_file_path;
    /*
     * file for design/layout panel
     */
    $supermag_customizer_design_options_file_path = supermag_file_directory('acmethemes/customizer/design-options/design-panel.php');
    require $supermag_customizer_design_options_file_path;
    /*
     * file for single post sections
     */
    $supermag_customizer_single_post_section_file_path = supermag_file_directory('acmethemes/customizer/single-posts/single-post-section.php');
    require $supermag_customizer_single_post_section_file_path;
    /*
     * file for options panel
     */
    $supermag_customizer_options_panel_file_path = supermag_file_directory('acmethemes/customizer/options/options-panel.php');
    require $supermag_customizer_options_panel_file_path;
    /*
     * file for options reset
     */
    $supermag_customizer_options_reset_file_path = supermag_file_directory('acmethemes/customizer/options/options-reset.php');
    require $supermag_customizer_options_reset_file_path;
    /*removing*/
    $wp_customize->remove_panel('header_image');
    $wp_customize->remove_control('header_textcolor');
}
 public function customize_register(WP_Customize_Manager $customizeManager)
 {
     // this field will be checked in settings method
     PP_Customizer_Customizer()->settings->customizeManager = $customizeManager;
     $settings = PP_Customizer_Customizer()->settings->get_settings();
     foreach ($settings as $sectionID => $isEnabled) {
         if ($isEnabled == 'false') {
             $panel = $customizeManager->get_panel($sectionID);
             if (isset($panel) && $panel != null) {
                 // is a panel, remove it
                 $customizeManager->remove_panel($sectionID);
             } else {
                 $customizeManager->remove_section($sectionID);
             }
         }
     }
 }
예제 #5
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function responsiveboat_customize_register($wp_customize)
{
    /* Remove About us section */
    $wp_customize->remove_panel('panel_about');
    $wp_customize->remove_section('zerif_aboutus_settings_section');
    $wp_customize->remove_section('zerif_aboutus_main_section');
    $wp_customize->remove_section('zerif_aboutus_feat1_section');
    $wp_customize->remove_section('zerif_aboutus_feat2_section');
    $wp_customize->remove_section('zerif_aboutus_feat3_section');
    $wp_customize->remove_section('zerif_aboutus_feat4_section');
    $wp_customize->remove_section('zerif_aboutus_clients_section');
    $wp_customize->remove_section('zerif_contactus_section');
    /**************************************/
    /********** Big title image **********/
    /*************************************/
    $wp_customize->add_setting('rb_bigtitle_logo', array('sanitize_callback' => 'esc_url_raw', 'default' => get_stylesheet_directory_uri() . '/images/logo-small.png'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'rb_bigtitle_logo', array('label' => __('Header Logo', 'responsiveboat'), 'section' => 'zerif_bigtitle_section', 'priority' => 7)));
    /**************************************/
    /********   About me section *********/
    /*************************************/
    $wp_customize->add_section('rb_aboutyou_section', array('title' => __('About you section', 'responsiveboat'), 'priority' => 34));
    /* about you show/hide */
    $wp_customize->add_setting('rb_aboutyou_show', array('sanitize_callback' => 'responsiveboat_sanitize_text'));
    $wp_customize->add_control('rb_aboutyou_show', array('type' => 'checkbox', 'label' => __('Hide about you section?', 'responsiveboat'), 'section' => 'rb_aboutyou_section', 'priority' => 1));
    /* title */
    $wp_customize->add_setting('rb_aboutyou_title', array('sanitize_callback' => 'responsiveboat_sanitize_text', 'default' => __('About you', 'responsiveboat')));
    $wp_customize->add_control('rb_aboutyou_title', array('label' => __('Title', 'responsiveboat'), 'section' => 'rb_aboutyou_section', 'priority' => 2));
    /* subtitle */
    $wp_customize->add_setting('rb_aboutyou_subtitle', array('sanitize_callback' => 'responsiveboat_sanitize_text', 'default' => __('Use this section to showcase important details about you.', 'responsiveboat')));
    $wp_customize->add_control('rb_aboutyou_subtitle', array('label' => __('Subtitle', 'responsiveboat'), 'section' => 'rb_aboutyou_section', 'priority' => 3));
    /* text */
    $wp_customize->add_setting('rb_aboutyou_text', array('sanitize_callback' => 'responsiveboat_sanitize_text', 'default' => __('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec massa enim. Aliquam viverra at est ullamcorper sollicitudin. Proin a leo sit amet nunc malesuada imperdiet pharetra ut eros.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec massa enim. Aliquam viverra at est ullamcorper sollicitudin. Proin a leo sit amet nunc malesuada imperdiet pharetra ut eros. <br><br>Mauris vel nunc at ipsum fermentum pellentesque quis ut massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas non adipiscing massa. Sed ut fringilla sapien. Cras sollicitudin, lectus sed tincidunt cursus, magna lectus vehicula augue, a lobortis dui orci et est.', 'responsiveboat')));
    $wp_customize->add_control('rb_aboutyou_text', array('label' => __('Text', 'responsiveboat'), 'section' => 'rb_aboutyou_section', 'priority' => 4));
    /* image */
    $wp_customize->add_setting('rb_aboutyou_image', array('sanitize_callback' => 'esc_url_raw', 'default' => get_stylesheet_directory_uri() . '/images/about.jpg'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'rb_aboutyou_image', array('label' => __('Image', 'responsiveboat'), 'section' => 'rb_aboutyou_section', 'priority' => 5)));
}
예제 #6
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function klean_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->remove_section('nav');
    $wp_customize->remove_panel('widgets');
    $wp_customize->add_setting('logo', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => __('OR Logo Upload', 'klean'), 'section' => 'title_tagline', 'settings' => 'logo')));
    $wp_customize->add_section('klean_layout', array('title' => __('Layout Settings', 'klean'), 'description' => __('Manage the Layout Settings of your site.', 'klean'), 'priority' => 1));
    $wp_customize->add_setting('klean-post-sidebar', array('default' => false, 'sanitize_callback' => 'klean_sanitize_checkbox'));
    $wp_customize->add_control('klean-post-sidebar', array('type' => 'checkbox', 'label' => __('Hide Sidebar on Posts/Pages', 'klean'), 'section' => 'klean_layout', 'priority' => 1));
    $wp_customize->add_section('klean_social', array('title' => __('Social Settings', 'klean'), 'description' => __('Manage the Social Icon Setings of your site.', 'klean'), 'priority' => 3));
    $wp_customize->add_setting('social', array('default' => false, 'sanitize_callback' => 'klean_sanitize_checkbox'));
    $wp_customize->add_control('social', array('type' => 'checkbox', 'label' => __('Enable Social Icons', 'klean'), 'section' => 'klean_social', 'priority' => 1));
    $wp_customize->add_setting('klean-social-color', array('sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'klean-social-color', array('label' => __('Background of the Social Icons', 'klean'), 'section' => 'klean_social', 'settings' => 'klean-social-color')));
    $wp_customize->add_setting('klean-social-icon-color', array('sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'klean-social-icon-color', array('label' => __('Color of the Social Icons', 'klean'), 'section' => 'klean_social', 'settings' => 'klean-social-icon-color')));
    $wp_customize->add_setting('facebook', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('facebook', array('label' => __('Facebook URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('twitter', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('twitter', array('label' => __('Twitter URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('google-plus', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('google-plus', array('label' => __('Google Plus URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('instagram', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('instagram', array('label' => __('Instagram URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('pinterest-p', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('pinterest-p', array('label' => __('Pinterest URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('youtube', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('youtube', array('label' => __('Youtube URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('linkedin', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('linkedin', array('label' => __('Linked-In URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('vimeo-square', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('vimeo-square', array('label' => __('Vimeo URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('envelope-o', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('envelope-o', array('label' => __('Your E-Mail Info', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('tumblr', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('tumblr', array('label' => __('Tumblr URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('stumbleupon', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('stumbleupon', array('label' => __('StumbleUpon URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('reddit', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('reddit', array('label' => __('Reddit URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('vine', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('vine', array('label' => __('Vine URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('soundcloud', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('soundcloud', array('label' => __('SoundCloud URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    $wp_customize->add_setting('yelp', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('yelp', array('label' => __('Yelp URL', 'klean'), 'section' => 'klean_social', 'type' => 'text'));
    class Custom_CSS_Control extends WP_Customize_Control
    {
        public $type = 'textarea';
        public function render_content()
        {
            ?>
	            <label>
	                <span class="customize-control-title"><?php 
            echo esc_html($this->label);
            ?>
</span>
	                <textarea rows="8" style="width:100%;background: black; color: white;" <?php 
            $this->link();
            ?>
><?php 
            echo esc_textarea($this->value());
            ?>
</textarea>
	            </label>
	        <?php 
        }
    }
    class TextBox_Control extends WP_Customize_Control
    {
        public $type = 'textarea';
        public function render_content()
        {
            ?>
	            <label>
	                <span class="customize-control-title"><?php 
            echo esc_html($this->label);
            ?>
</span>
	                <textarea rows="8" style="width:100%;background: white; color: black;" <?php 
            $this->link();
            ?>
><?php 
            echo esc_textarea($this->value());
            ?>
</textarea>
	            </label>
	        <?php 
        }
    }
    $wp_customize->add_section('custom_set', array('title' => __('Custom Settings', 'klean'), 'description' => __('Add some custom CSS code to edit your theme.', 'klean'), 'priority' => 30));
    $wp_customize->add_setting('css', array('default' => '', 'sanitize_callback' => 'klean_sanitize_text'));
    $wp_customize->add_control(new Custom_CSS_Control($wp_customize, 'css', array('label' => __('Custom CSS', 'klean'), 'section' => 'custom_set', 'settings' => 'css')));
    $wp_customize->add_setting('klean-footer-text', array('default' => '', 'sanitize_callback' => 'klean_sanitize_text'));
    $wp_customize->add_control(new TextBox_Control($wp_customize, 'klean-footer-text', array('label' => __('Footer Text', 'klean'), 'section' => 'custom_set', 'settings' => 'klean-footer-text')));
    $wp_customize->add_section('klean_pro', array('title' => __('GO PRO !!!', 'klean'), 'description' => __('<i>Now you can upgrade to Klean Pro and unlock the full features of the theme. <br><br>The pro version is available at only $25.<br><br><b>To purchase the Pro version, go <a href="http://www.divjot.co/product/super-klean">here</a>.</b></i>', 'klean'), 'priority' => 999));
    class MyCustom_Customize_Control extends WP_Customize_Control
    {
        public function render_content()
        {
            ?>
	        <label>
						<input type="checkbox" value="<?php 
            echo esc_attr($this->value());
            ?>
" <?php 
            $this->link();
            checked($this->value());
            ?>
 />
						<?php 
            echo esc_html($this->label);
            ?>
						<?php 
            if (!empty($this->description)) {
                ?>
							<span class="description customize-control-description"><?php 
                echo $this->description;
                ?>
</span>
						<?php 
            }
            ?>
					</label>
					
					<script>
					jQuery(function($){
						/* $('#customize-control-pro_hide' ).show(); */
						/*
wp.customize( 'pro_hide', function( value ) {
							value.bind( function( to ) {
*/
								$( '#customize-control-pro_hide' ).hide();
								$( '#accordion-section-klean_pro #accordion-section-title' ).css({"color":"#fff"});
							/*
} );
						} );
*/						
					});
					</script>

					
	        <?php 
        }
    }
    $wp_customize->add_setting('pro_hide', array('default' => false, 'sanitize_callback' => 'klean_sanitize_checkbox'));
    $wp_customize->add_control(new MyCustom_Customize_Control($wp_customize, 'pro_hide', array('type' => 'checkbox', 'label' => __('Hide this section forever.', 'klean'), 'section' => 'klean_pro', 'priority' => 1)));
    function klean_sanitize_checkbox($i)
    {
        if ($i == 1) {
            return 1;
        } else {
            return '';
        }
    }
    function klean_sanitize_text($input)
    {
        return wp_kses_post(force_balance_tags($input));
    }
}