esc_html__('ON', 'biznis'), 'off' => esc_html__('OFF', 'biznis') ); return apply_filters('section_option', $biznis_section_option); } endif; // Extra Function For Layout if (!function_exists('biznis_col_layout_option')) : function biznis_col_layout_option() { $biznis_col_layout_option = array( '6' => esc_html__('2 Column Layout', 'biznis'), '4' => esc_html__('3 Column Layout', 'biznis'), ); return apply_filters('col_layout_option', $biznis_col_layout_option); } endif; /* Sanitization */ if ( !function_exists('sanitize_select') ) : function sanitize_select( $input, $setting ) { // Ensure input is a slug. $input = sanitize_text_field( $input ); // Get list of choices from the control associated with the setting. $choices = $setting->manager->get_control( $setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } endif; /** * Drop-down Pages sanitization aboutback example. * * - Sanitization: dropdown-pages * - Control: dropdown-pages * * Sanitization aboutback for 'dropdown-pages' type controls. This aboutback sanitizes `$page_id` * as an absolute integer, and then validates that $input is the ID of a published page. * * @see absint() https://developer.wordpress.org/reference/functions/absint/ * @see get_post_status() https://developer.wordpress.org/reference/functions/get_post_status/ * * @param int $page Page ID. * @param WP_Customize_Setting $setting Setting instance. * @return int|string Page ID if the page is published; otherwise, the setting default. */ function sanitize_dropdown_pages( $page_id, $setting ) { // Ensure $input is an absolute integer. $page_id = absint( $page_id ); // If $page_id is an ID of a published page, return it; otherwise, return the default. return ( 'publish' == get_post_status( $page_id ) ? $page_id : $setting->default ); } /** Front Page Setting **/ $wp_customize->add_panel('biznis-frontpage', array('title' => esc_html__('Biznis Section Setting', 'biznis'), 'description' => '', 'priority' => 5,) ); // Add Header Bar Section /** Start Header Social Bar **/ $wp_customize->add_section('biznis_header_bar', array( 'title' => esc_html__('Header Bar', 'biznis'), 'description' => '', 'panel' => 'biznis-frontpage', 'priority' => 100 )); $wp_customize->add_setting( 'biznis_header_button_onoff', array( 'default' => esc_html__('off','biznis'), 'sanitize_callback' => 'sanitize_select', ) ); $biznis_header_onoff = biznis_section_option(); $wp_customize->add_control( 'biznis_header_button_onoff', array( 'type' => 'radio', 'label' => esc_html__('Header bar', 'biznis'), 'description' => esc_html__('show/hide option for Header bar.', 'biznis'), 'section' => 'biznis_header_bar', 'choices' => $biznis_header_onoff, 'priority' => 1 ) ); $biznis_header_bar_link_no = 4; for( $i = 1; $i <= $biznis_header_bar_link_no; $i++ ) { $biznis_header_bar_link = 'header_bar_link_' . $i; $biznis_header_bar_link_text = 'header_bar_link_text_' . $i; $label_text = esc_html__( 'Text #' , 'biznis' ) . $i; $label_icon = esc_html__( 'URL #' , 'biznis' ) . $i; $wp_customize->add_setting( $biznis_header_bar_link_text, array( 'default' => esc_html__(' ','biznis'), 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control( $biznis_header_bar_link_text, array( 'label' => $label_text, 'section' => 'biznis_header_bar', 'type' => 'text', 'priority' => 100 + $i )); if ( $i != 4 ) : $wp_customize->add_setting( $biznis_header_bar_link, array( 'default' => esc_html__(' ','biznis'), 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( $biznis_header_bar_link, array( 'label' => $label_icon, 'section' => 'biznis_header_bar', 'type' => 'text', 'priority' => 100 + $i )); endif; } $biznis_header_bar_social_link_no = 6; for( $i = 1; $i <= $biznis_header_bar_social_link_no; $i++ ) { $biznis_header_bar_social_link = 'header_bar_social_link_' . $i; $label = esc_html__( 'Social Icon URL #', 'biznis' ) . $i; $wp_customize->add_setting( $biznis_header_bar_social_link, array( 'default' => esc_html__(' ','biznis'), 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( $biznis_header_bar_social_link, array( 'label' => $label, 'section' => 'biznis_header_bar', 'type' => 'text', 'priority' => 110 + $i )); } // Add Search Section /** Start Menu search button **/ $wp_customize->add_section('search', array( 'title' => esc_html__('Nav Search Button', 'biznis'), 'description' => '', 'panel' => 'biznis-frontpage', 'priority' => 110 )); $wp_customize->add_setting( 'search_button_onoff', array( 'default' => esc_html__('off','biznis'), 'sanitize_callback' => 'sanitize_select', ) ); $search_onoff = biznis_section_option(); $wp_customize->add_control( 'search_button_onoff', array( 'type' => 'radio', 'label' => esc_html__('Navbar Button', 'biznis'), 'description' => esc_html__('show/hide option for Search button.', 'biznis'), 'section' => 'search', 'choices' => $search_onoff, 'priority' => 1 ) ); // Add Slider Section /** Start Slider Section **/ $wp_customize->add_section('biznis_slider', array( 'title' => esc_html__('Slider', 'biznis'), 'description' => '', 'panel' => 'biznis-frontpage', 'priority' => 120 )); $wp_customize->add_setting( 'biznis_header_slider_onoff', array( 'default' => esc_html__('off','biznis'), 'sanitize_callback' => 'sanitize_select', ) ); $biznis_slider_onoff = biznis_section_option(); $wp_customize->add_control( 'biznis_header_slider_onoff', array( 'type' => 'radio', 'label' => esc_html__('Slider', 'biznis'), 'description' => esc_html__('show/hide option for Slider.', 'biznis'), 'section' => 'biznis_slider', 'choices' => $biznis_slider_onoff, 'priority' => 1 ) ); $slide_no = 3; for( $i = 1; $i <= $slide_no; $i++ ) { $biznis_slider_image = 'biznis_slider_image_' . $i; $biznis_slider_heading = 'biznis_slider_heading_' . $i; $biznis_slider_sub_heading = 'biznis_slider_sub_heading_' . $i; $biznis_slider_btntxt = 'biznis_slider_btn1_txt_' . $i; $biznis_slider_btnurl = 'biznis_slider_btn1_url_' . $i; $biznis_slider_image_label = esc_html__('Select image For Slide #', 'biznis') . $i; $biznis_slider_heading_label = esc_html__('Slide #', 'biznis') . $i . esc_html__(' Heading', 'biznis'); $biznis_slider_sub_heading_label = esc_html__('Slide #', 'biznis') . $i . esc_html__(' Sub Heading', 'biznis'); $biznis_slider_btntxt_label = esc_html__('Slide #', 'biznis') . $i . esc_html__(' Button #1 Text', 'biznis'); $biznis_slider_btnurl_label = esc_html__('Slide #', 'biznis') . $i . esc_html__(' Button #1 URL', 'biznis'); // Slider Image $wp_customize->add_setting( $biznis_slider_image, array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'biznis_slider_image_' . $i, array( 'label' => $biznis_slider_image_label, 'section' => 'biznis_slider', 'description' => esc_html__('Select image For Slide #', 'biznis').$i, 'settings' => $biznis_slider_image, 'priority' => 20 + $i ))); // Slider Heading $wp_customize->add_setting($biznis_slider_heading, array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control($biznis_slider_heading, array( 'label' => $biznis_slider_heading_label, 'type' => 'text', 'section' => 'biznis_slider', 'priority' => 20 + $i )); // Slider Sub Heading $wp_customize->add_setting($biznis_slider_sub_heading, array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control($biznis_slider_sub_heading, array( 'label' => $biznis_slider_sub_heading_label, 'type' => 'text', 'section' => 'biznis_slider', 'priority' => 20 + $i )); // Slider Button 1 Text $wp_customize->add_setting( $biznis_slider_btntxt, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control( $biznis_slider_btntxt, array( 'label' => $biznis_slider_btntxt_label, 'section' => 'biznis_slider', 'type' => 'text', 'priority' => 20 + $i )); // Slider Button 1 URL $wp_customize->add_setting( $biznis_slider_btnurl, array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( $biznis_slider_btnurl, array( 'label' => $biznis_slider_btnurl_label, 'section' => 'biznis_slider', 'priority' => 20 + $i )); } // Add Callout Section /** Start Callout Section **/ $wp_customize->add_section('biznis_callout', array( 'title' => esc_html__('Callout Section', 'biznis'), 'description' => '', 'panel' => 'biznis-frontpage', 'priority' => 130 )); $wp_customize->add_setting( 'callout_button_onoff', array( 'default' => esc_html__('off','biznis'), 'sanitize_callback' => 'sanitize_select', ) ); $biznis_callout_onoff = biznis_section_option(); $wp_customize->add_control( 'callout_button_onoff', array( 'type' => 'radio', 'label' => esc_html__('Callout section', 'biznis'), 'description' => esc_html__('show/hide option for Callout Section.', 'biznis'), 'section' => 'biznis_callout', 'choices' => $biznis_callout_onoff, 'priority' => 1 ) ); // Callout Title $wp_customize->add_setting('callout_title', array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('callout_title', array( 'label' => esc_html__('Title', 'biznis'), 'section' => 'biznis_callout', 'priority' => 2 )); // Button Text $wp_customize->add_setting( 'callout_btn_txt', array( 'default' => esc_html__(' ','biznis'), 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control( 'callout_btn_txt', array( 'label' => esc_html__( 'Button Text ', 'biznis' ), 'section' => 'biznis_callout', 'type' => 'text', 'priority' => 3 )); // Button 1 URL $wp_customize->add_setting( 'callout_btn_url', array( 'default' => esc_html__(' ','biznis'), 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( 'callout_btn_url', array( 'label' => esc_html__( 'Button URL', 'biznis' ), 'section' => 'biznis_callout', 'priority' => 4 )); // Add Service Section /** Start Service Section **/ $wp_customize->add_section('biznis_service', array( 'title' => esc_html__('Service Section', 'biznis'), 'description' => '', 'panel' => 'biznis-frontpage', 'priority' => 140 )); $wp_customize->add_setting( 'service_button_onoff', array( 'default' => esc_html__('off','biznis'), 'sanitize_callback' => 'sanitize_select', ) ); $biznis_service_onoff = biznis_section_option(); $wp_customize->add_control( 'service_button_onoff', array( 'type' => 'radio', 'label' => esc_html__('Service Section', 'biznis'), 'description' => esc_html__('show/hide option for Service Section.', 'biznis'), 'section' => 'biznis_service', 'choices' => $biznis_service_onoff, 'priority' => 2 ) ); // Services Title $wp_customize->add_setting('service_title', array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('service_title', array( 'label' => esc_html__('Services Section Title', 'biznis'), 'section' => 'biznis_service', 'priority' => 3 )); // Services Subtitle $wp_customize->add_setting('service_subtitle', array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('service_subtitle', array( 'label' => esc_html__('Services Section Sub Title', 'biznis'), 'section' => 'biznis_service', 'priority' => 4 )); $biznis_service_no = 3; for( $i = 1; $i <= $biznis_service_no; $i++ ) { $biznis_service_page_icon = 'service_page_icon_' . $i; $biznis_service_page = 'service_page_' . $i; $biznis_service_page_icon_label = esc_html__( 'Icon #', 'biznis' ) . $i; $biznis_service_page_label = esc_html__( 'Page #', 'biznis' ) . $i; // Setting - Service Icon $wp_customize->add_setting( $biznis_service_page_icon, array( 'default' => esc_html__(' ','biznis'), 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( $biznis_service_page_icon, array( 'label' => $biznis_service_page_icon_label, 'description' => __('Select a icon in this list Font Awesome icons and enter the class name','biznis'), 'section' => 'biznis_service', 'type' => 'text', 'priority' => 100, ) ); // Setting - Page $wp_customize->add_setting( $biznis_service_page, array( 'default' => esc_html__(' ','biznis'), 'sanitize_callback' => 'sanitize_dropdown_pages', ) ); $wp_customize->add_control( $biznis_service_page, array( 'label' => $biznis_service_page_label, 'section' => 'biznis_service', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } // Add Feature Section /** Start Feature Section **/ $wp_customize->add_section('biznis_feature', array( 'title' => esc_html__('Feature Section', 'biznis'), 'description' => '', 'panel' => 'biznis-frontpage', 'priority' => 150 )); $wp_customize->add_setting( 'feature_button_onoff', array( 'default' => esc_html__('off','biznis'), 'sanitize_callback' => 'sanitize_select', ) ); $biznis_feature_onoff = biznis_section_option(); $wp_customize->add_control( 'feature_button_onoff', array( 'type' => 'radio', 'label' => esc_html__('Feature Section', 'biznis'), 'description' => esc_html__('show/hide option for Feature Section.', 'biznis'), 'section' => 'biznis_feature', 'choices' => $biznis_feature_onoff, 'priority' => 1 ) ); // Features Title $wp_customize->add_setting('feature_title', array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('feature_title', array( 'label' => esc_html__('Features Section Title', 'biznis'), 'section' => 'biznis_feature', 'priority' => 3 )); // Features Subtitle $wp_customize->add_setting('feature_subtitle', array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('feature_subtitle', array( 'label' => esc_html__('Features Section Sub Title', 'biznis'), 'section' => 'biznis_feature', 'priority' => 4 )); $biznis_feature_no = 4; for( $i = 1; $i <= $biznis_feature_no; $i++ ) { $biznis_feature_page_icon = 'feature_page_icon_' . $i; $biznis_feature_page = 'feature_page_' . $i; $biznis_feature_page_icon_label = esc_html__( 'Icon #', 'biznis' ) . $i; $biznis_feature_page_label = esc_html__( 'Page #', 'biznis' ) . $i; // Setting - Feature Icon $wp_customize->add_setting( $biznis_feature_page_icon, array( 'default' => esc_html__(' ','biznis'), 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( $biznis_feature_page_icon, array( 'label' => $biznis_feature_page_icon_label, 'description' => __('Select a icon in this list Font Awesome icons and enter the class name','biznis'), 'section' => 'biznis_feature', 'type' => 'text', 'priority' => 100, ) ); // Setting - Page $wp_customize->add_setting( $biznis_feature_page, array( 'default' => esc_html__(' ','biznis'), 'sanitize_callback' => 'sanitize_dropdown_pages', ) ); $wp_customize->add_control( $biznis_feature_page, array( 'label' => $biznis_feature_page_label, 'section' => 'biznis_feature', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } // Add Blog Section /** Start Blog Section **/ $wp_customize->add_section('biznis_blog', array( 'title' => esc_html__('Blog Section', 'biznis'), 'description' => '', 'panel' => 'biznis-frontpage', 'priority' => 160 )); $wp_customize->add_setting( 'blog_button_onoff', array( 'default' => esc_html__('on','biznis'), 'sanitize_callback' => 'sanitize_select', ) ); $biznis_blog_onoff = biznis_section_option(); $wp_customize->add_control( 'blog_button_onoff', array( 'type' => 'radio', 'label' => esc_html__('Blog Section', 'biznis'), 'description' => esc_html__('show/hide option for Blog Section.', 'biznis'), 'section' => 'biznis_blog', 'choices' => $biznis_blog_onoff, 'priority' => 2 ) ); // Blog Title $wp_customize->add_setting('blog_title', array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('blog_title', array( 'label' => esc_html__('Blog Section Title', 'biznis'), 'section' => 'biznis_blog', 'priority' => 3 )); // Blog Subtitle $wp_customize->add_setting('blog_subtitle', array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('blog_subtitle', array( 'label' => esc_html__('Blog Section Sub Title', 'biznis'), 'section' => 'biznis_blog', 'priority' => 4 )); // Blog Number of post $wp_customize->add_setting('blog_post_count', array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('blog_post_count', array( 'label' => esc_html__('Number of Post for Blog Section', 'biznis'), 'section' => 'biznis_blog', 'type' => 'text', 'priority' => 5 )); // Add Footer Section /** Start Footer Section **/ $wp_customize->add_section('biznis_footer', array( 'title' => esc_html__('Footer Section', 'biznis'), 'description' => '', 'panel' => 'biznis-frontpage', 'priority' => 170 )); $wp_customize->add_setting( 'footer_button_onoff', array( 'default' => esc_html__('off','biznis'), 'sanitize_callback' => 'sanitize_select', ) ); $binis_footer_onoff = biznis_section_option(); $wp_customize->add_control( 'footer_button_onoff', array( 'type' => 'radio', 'label' => esc_html__('Footer Section', 'biznis'), 'description' => esc_html__('show/hide option for Footer Section.', 'biznis'), 'section' => 'biznis_footer', 'choices' => $binis_footer_onoff, 'priority' => 2 ) ); // Footer Copyright $wp_customize->add_setting('footer_copyright', array( 'default' => esc_html__(' ','biznis'), 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('footer_copyright', array( 'label' => esc_html__('Copyright', 'biznis'), 'section' => 'biznis_footer', 'type' => 'textarea', 'priority' => 3 )); } endif; add_action( 'customize_register', 'biznis_customizer_register' );