esc_html__('3','brikshya-blog'), 'home_featured_section_noOfPosts' => esc_html__('3','brikshya-blog'), 'home_posts_section_title' => esc_html__('Recent Posts','brikshya-blog'), 'home_posts_section_noOfPosts' => esc_html__('5','brikshya-blog'), 'home_posts_section_select_categories' => esc_html__('','brikshya-blog') ); return isset($defaults[$theme_mod]) ? $defaults[$theme_mod] : false; } function brikshya_blog_home_page_customizer($wp_customize) { // Create custom panel. $wp_customize->add_panel('cutomizer', array( 'priority' => 40, 'theme_supports' => '', 'title' => __('Customizer', 'brikshya-blog'), 'description' => __('Set editable text for certain content.', 'brikshya-blog'), )); // Add Section header category menu . $wp_customize->add_section('category_menu_section', array( 'title' => esc_html__('Category Menu Section', 'brikshya-blog'), 'panel' => 'cutomizer', 'priority' => 10, 'description' => esc_html__('Diplay Catgory Menu section?. ', 'brikshya-blog'), )); // Add Section header category menu . $wp_customize->add_setting('category_menu_section_checkbox', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses', )); // Add Section header category menu . $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'category_menu_section_control', array( 'label' => esc_html__('Hide this section?', 'brikshya-blog'), 'section' => 'category_menu_section', 'settings' => 'category_menu_section_checkbox', 'type' => 'checkbox', ))); // Add Section header category menu . $wp_customize->add_setting('category_menu_section_show_parent_cat_checkbox', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses', )); // Add Section header category menu . $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'category_menu_section_show_parent_cat_checkbox_control', array( 'label' => esc_html__('Show all Category', 'brikshya-blog'), 'section' => 'category_menu_section', 'settings' => 'category_menu_section_show_parent_cat_checkbox', 'type' => 'checkbox', 'description' => esc_html__('Check to show all category, Uncheck to show only parents category', 'brikshya-blog'), ))); // Add Section Home Slider $wp_customize->add_section('home_slider_section', array( 'title' => esc_html__('Slider Section', 'brikshya-blog'), 'panel' => 'cutomizer', 'priority' => 10, 'description' => esc_html__('Diplay Slider Section? It is only vissible in home page template. ', 'brikshya-blog'), )); // Add setting Home Slider Section. $wp_customize->add_setting('home_slider_section_checkbox', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses', )); // Add Control Home Slider Section. $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'home_slider_section_control', array( 'label' => __('Hide this section?', 'brikshya-blog'), 'section' => 'home_slider_section', 'settings' => 'home_slider_section_checkbox', 'type' => 'checkbox', ))); // Add setting Home Slider Section. $wp_customize->add_setting('home_slider_section_noOfPosts', array( 'default' => brikshya_blog__customizer_default( 'home_slider_section_noOfPosts' ), 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses', )); // Add Control Home Slider Section. $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'home_slider_section_noOfPosts_control', array( 'label' => __('Number Of Posts', 'brikshya-blog'), 'section' => 'home_slider_section', 'settings' => 'home_slider_section_noOfPosts', 'type' => 'number', ))); // Add Section Home Featured $wp_customize->add_section('home_featured_section', array( 'title' => esc_html__('Featured Section', 'brikshya-blog'), 'panel' => 'cutomizer', 'priority' => 10, 'description' => esc_html__('Diplay Featured Section? It is only vissible in home page template. ', 'brikshya-blog'), )); // Add setting Home Featured Section. $wp_customize->add_setting('home_featured_section_checkbox', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses', )); // Add Control Home Featured Section. $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'home_featured_section_control', array( 'label' => __('Hide this section?', 'brikshya-blog'), 'section' => 'home_featured_section', 'settings' => 'home_featured_section_checkbox', 'type' => 'checkbox', ))); // Add setting Home Featured Section. $wp_customize->add_setting('home_featured_section_noOfPosts', array( 'default' => brikshya_blog__customizer_default( 'home_featured_section_noOfPosts' ), 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses', )); // Add Control Home Featured Section. $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'home_featured_section_noOfPosts_control', array( 'label' => __('Number Of Posts', 'brikshya-blog'), 'section' => 'home_featured_section', 'settings' => 'home_featured_section_noOfPosts', 'type' => 'number', ))); $categories = get_categories(); $cats = array(); $i = 0; foreach( $categories as $category ) { // uncomment to see all $category data #print_r($category); if( $i == 0 ){ $default = $category->term_id; $i++; } $cats[''] = 'Select All'; $cats[$category->term_id] = $category->name; } // Add Section Home Posts $wp_customize->add_section('home_posts_section', array( 'title' => esc_html__('Posts Section', 'brikshya-blog'), 'panel' => 'cutomizer', 'priority' => 10, 'description' => esc_html__('Diplay Posts Section? It is only vissible in home page template. ', 'brikshya-blog'), )); // Add setting Home Posts Section. $wp_customize->add_setting('home_posts_section_checkbox', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses', )); // Add Control Home Posts Section. $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'home_posts_section_control', array( 'label' => esc_html__('Hide this section?', 'brikshya-blog'), 'section' => 'home_posts_section', 'settings' => 'home_posts_section_checkbox', 'type' => 'checkbox', 'description' => esc_html__('Hiding this section will also hide sidebar for home page template.', 'brikshya-blog'), ))); // Add setting Home Posts Section. $wp_customize->add_setting('home_posts_section_title', array( 'default' => brikshya_blog__customizer_default( 'home_posts_section_title' ), 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses', )); // Add Control Home Posts Section. $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'home_posts_section_title_control', array( 'label' => esc_html__('Title', 'brikshya-blog'), 'section' => 'home_posts_section', 'settings' => 'home_posts_section_title', 'type' => 'text', ))); // Add setting Home Featured Section. $wp_customize->add_setting('home_posts_section_noOfPosts', array( 'default' => brikshya_blog__customizer_default( 'home_posts_section_noOfPosts' ), 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses', )); // Add Control Home Featured Section. $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'home_posts_section_noOfPosts_control', array( 'label' => __('Number Of Posts', 'brikshya-blog'), 'section' => 'home_posts_section', 'settings' => 'home_posts_section_noOfPosts', 'type' => 'number', ))); // Add setting Home Posts Section. $wp_customize->add_setting('home_posts_section_select_categories', array( 'default' => brikshya_blog__customizer_default( 'home_posts_section_select_categories' ), 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses', )); // Add Control Home Posts Section. $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'home_posts_section_select_categories_control', array( 'label' => esc_html__('Select Categories', 'brikshya-blog'), 'section' => 'home_posts_section', 'settings' => 'home_posts_section_select_categories', 'type' => 'select', 'choices' => $cats, 'description' => esc_html__('Posts of Selected Categorie will be displayed in template home page. Leave empty to show posts from all category', 'brikshya-blog'), ))); }