cats = get_categories($options); parent::__construct( $manager, $id, $args ); } /** * Render the content of the category dropdown * * @return HTML */ public function render_content() { if(!empty($this->cats)) { ?> add_panel( 'slider_panel', array( 'priority' => 126, 'capability' => 'edit_theme_options', 'title' => __('Slider Section', 'business' ), ) ); /* Slider Settings */ $wp_customize->add_section( 'slider_setting' , array( 'title' => __('Settings', 'business' ), 'panel' => 'slider_panel' ) ); // slider enable $wp_customize->add_setting( 'business_option[slider_enable]' , array( 'default' => true, 'sanitize_callback' => 'wlsbusiness_sanitize_checkbox', 'type'=>'option' )); $wp_customize->add_control('business_option[slider_enable]' , array( 'label' => __('Enable Slider','business' ), 'section' => 'slider_setting', 'type'=>'checkbox', ) ); // slider animation type $wp_customize->add_setting( 'business_option[slider_animation_type]' , array( 'default' => 'slide', 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_option[slider_animation_type]' , array( 'label' => __('Slider Animation Type','business' ), 'section' => 'slider_setting', 'type'=>'select', 'choices'=>array( 'slide'=>'Slide', 'fade'=>'Fade', ), ) ); // slider speed $wp_customize->add_setting( 'business_option[slider_speed]' , array( 'default' => 3000, 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_option[slider_speed]' , array( 'label' => __('Slider Speed','business' ), 'section' => 'slider_setting', 'type'=>'select', 'choices'=>array( 500 => 500, 1000 => 1000, 2000 => 2000, 3000 => 3000, 4000 => 4000, 5000 => 5000, 6000 => 6000, 7000 => 7000, 8000 => 8000, 9000 => 9000, 10000 => 10000, ), ) ); /* Slider Slides */ $wp_customize->add_section( 'slider_slide' , array( 'title' => __('Slider Content', 'business' ), 'panel' => 'slider_panel' ) ); // slider cat $wp_customize->add_setting('business_option[slider_cat]',array( 'default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wlsbusiness_slider_sanitize', 'type'=>'option', ) ); $wp_customize->add_control( new wlsbusiness_category_dropdown_custom_control( $wp_customize, 'business_option[slider_cat]', array( 'label' => __('Select category to show slides','business' ), 'section' => 'slider_slide', 'settings' => 'business_option[slider_cat]', ) ) ); /* SERVICE SETTINGS */ $wp_customize->add_panel( 'service_panel', array( 'priority' => 128, 'capability' => 'edit_theme_options', 'title' => __('Service Section', 'business' ), ) ); /* Service Settings */ $wp_customize->add_section( 'service_settings' , array( 'title' => __('Service Settings', 'business' ), 'panel' => 'service_panel', 'priority' => 1, ) ); // service section enable/disable $wp_customize->add_setting( 'business_option[service_section_enable]' , array( 'default' => true, 'sanitize_callback' => 'wlsbusiness_sanitize_checkbox', 'type'=>'option' )); $wp_customize->add_control('business_option[service_section_enable]' , array( 'label' => __('Enable Service Section','business' ), 'section' => 'service_settings', 'type'=>'checkbox', ) ); /* Service header */ $wp_customize->add_section( 'service_header' , array( 'title' => __('Section Header', 'business' ), 'panel' => 'service_panel', 'priority' => 2, ) ); // service section title $wp_customize->add_setting( 'business_option[service_section_title]' , array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_option[service_section_title]' , array( 'label' => __('Service Section Title','business' ), 'section' => 'service_header', 'type'=>'text', ) ); // service section description $wp_customize->add_setting( 'business_option[service_section_description]' , array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_option[service_section_description]' , array( 'label' => __('Service Section Description','business' ), 'section' => 'service_header', 'type'=>'text', ) ); /* Service background */ $wp_customize->add_section( 'service_background' , array( 'title' => __('Section Background', 'business' ), 'panel' => 'service_panel', 'priority' => 3, ) ); // service section background color $wp_customize->add_setting( 'business_option[service_section_backgorund_color]' , array( 'default' => '#ffffff', 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize , 'business_option[service_section_backgorund_color]' , array( 'label' => __('Section Background Color','business' ), 'section' => 'service_background', 'settings'=>'business_option[service_section_backgorund_color]' ) ) ); // service section image $wp_customize->add_setting( 'business_option[service_section_image]' , array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw', 'type'=>'option' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize , 'business_option[service_section_image]' , array( 'label' => __( 'Service Section Image', 'business' ), 'section' => 'service_background', ) ) ); /* NEWS SETTINGS */ $wp_customize->add_panel( 'news_panel', array( 'priority' => 129, 'capability' => 'edit_theme_options', 'title' => __('News Section', 'business' ), ) ); /* News Settings */ $wp_customize->add_section( 'news_settings' , array( 'title' => __('Settings', 'business' ), 'panel' => 'news_panel' ) ); // news section enable/disable $wp_customize->add_setting( 'business_option[news_section_enable]' , array( 'default' => true, 'sanitize_callback' => 'wlsbusiness_sanitize_checkbox', 'type'=>'option' )); $wp_customize->add_control('business_option[news_section_enable]' , array( 'label' => __('Enable News Section','business' ), 'section' => 'news_settings', 'type'=>'checkbox', ) ); /* section header */ $wp_customize->add_section( 'news_header' , array( 'title' => __('Section Header', 'business' ), 'panel' => 'news_panel' ) ); // news section title $wp_customize->add_setting( 'business_option[news_section_title]' , array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_option[news_section_title]' , array( 'label' => __('News Section Title','business' ), 'section' => 'news_header', 'type'=>'text', ) ); // news section description $wp_customize->add_setting( 'business_option[news_section_description]' , array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_option[news_section_description]' , array( 'label' => __('News Section Description','business' ), 'section' => 'news_header', 'type'=>'text', ) ); /* section content */ $wp_customize->add_section( 'news_content' , array( 'title' => __('Section Contents', 'business' ), 'panel' => 'news_panel' ) ); // news no of show $wp_customize->add_setting( 'business_option[news_no_of_show]' , array( 'default' => 4, 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_option[news_no_of_show]' , array( 'label' => __('News No Of Show','business' ), 'section' => 'news_content', 'type'=>'number', ) ); // news category show $wp_customize->add_setting( 'business_option[news_category_show]' , array( 'default' => 1, 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_option[news_category_show]' , array( 'label' => __('News Category Show','business' ), 'section' => 'news_content', 'type'=>'select', 'choices'=> wlsbusiness_get_post_category(), ) ); /* section background */ $wp_customize->add_section( 'news_background' , array( 'title' => __('Section Background', 'business' ), 'panel' => 'news_panel' ) ); // news section background color $wp_customize->add_setting( 'business_option[news_section_backgorund_color]' , array( 'default' => '#F2FCFE', 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize , 'business_option[news_section_backgorund_color]' , array( 'label' => __('Section Background Color','business' ), 'section' => 'news_background', 'settings'=>'business_option[news_section_backgorund_color]' ) ) ); // News section image $wp_customize->add_setting( 'business_option[news_section_image]' , array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw', 'type'=>'option' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize , 'business_option[news_section_image]' , array( 'label' => __( 'News Section Image', 'business' ), 'section' => 'news_background', ) ) ); /* CONTACT SETTINGS */ $wp_customize->add_panel( 'contact_panel', array( 'priority' => 134, 'capability' => 'edit_theme_options', 'title' => __('Contact Section', 'business' ), ) ); /* Contact Settings */ $wp_customize->add_section( 'contact_settings' , array( 'title' => __('Settings', 'business' ), 'panel' => 'contact_panel', 'priority' => 1, ) ); // Contact section enable/disable $wp_customize->add_setting( 'business_option[contact_section_enable]' , array( 'default' => true, 'sanitize_callback' => 'wlsbusiness_sanitize_checkbox', 'type'=>'option' )); $wp_customize->add_control('business_option[contact_section_enable]' , array( 'label' => __('Enable Contact Section','business' ), 'section' => 'contact_settings', 'type'=>'checkbox', ) ); // Contact widget column layout $wp_customize->add_setting( 'business_option[contact_section_column]' , array( 'default' => 3, 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_option[contact_section_column]' , array( 'label' => __('Column Layout','business' ), 'section' => 'contact_settings', 'type'=>'select', 'choices'=>array( 1 => 1, 2 => 2, 3 => 3, 4 => 4, ) ) ); /* Contact header */ $wp_customize->add_section( 'contact_header' , array( 'title' => __('Contact Header', 'business' ), 'panel' => 'contact_panel', 'priority' => 2, ) ); // Contact section title $wp_customize->add_setting( 'business_option[contact_section_title]' , array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_option[contact_section_title]' , array( 'label' => __('Contact Section Title','business' ), 'section' => 'contact_header', 'type'=>'text', ) ); // Contact section description $wp_customize->add_setting( 'business_option[contact_section_description]' , array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_option[contact_section_description]' , array( 'label' => __('Contact Section Description','business' ), 'section' => 'contact_header', 'type'=>'text', ) ); } add_action( 'customize_register', 'wlsbusiness_homepage_settings_fucntion' ); function wlsbusiness_get_post_category(){ $cats = get_categories(); $arr = array(); foreach($cats as $cat){ $arr[$cat->term_id] = $cat->name; } return $arr; }