esc_html__('Show', 'beauty-parlour'), 'hide' => esc_html__('Hide', 'beauty-parlour') ); return apply_filters('beauty_parlour_section_choice_option', $beauty_parlour_section_choice_option); } endif; if (!function_exists('beauty_parlour_column_layout_option')) : function beauty_parlour_column_layout_option() { $beauty_parlour_column_layout_option = array( '6' => esc_html__('2 Column Layout', 'beauty-parlour'), '4' => esc_html__('3 Column Layout', 'beauty-parlour'), '3' => esc_html__('4 Column Layout', 'beauty-parlour'), ); return apply_filters('beauty_parlour_column_layout_option', $beauty_parlour_column_layout_option); } endif; /** * Sanitizing the select callback example * */ if ( !function_exists('beauty_parlour_sanitize_select') ) : function beauty_parlour_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; if ( !function_exists('beauty_parlour_column_layout_sanitize_select') ) : function beauty_parlour_column_layout_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; if ( !function_exists('beauty_parlour_column_layout_sanitize_select') ) : function beauty_parlour_column_layout_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 callback example. * * - Sanitization: dropdown-pages * - Control: dropdown-pages * * Sanitization callback for 'dropdown-pages' type controls. This callback 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 beauty_parlour_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 Section Settings starts **/ $wp_customize->add_panel('frontpage', array( 'title' => esc_html__('Beauty Parlour Options', 'beauty-parlour'), 'description' => '', 'priority' => 3, ) ); /** Header Section Settings end **/ /** Slider Section Settings Start **/ // Panel - Slider Section 1 $wp_customize->add_section('sliderinfo', array( 'title' => esc_html__('Home Slider Setting', 'beauty-parlour'), 'description' => '', 'panel' => 'frontpage', 'priority' => 35 ) ); // hide show $wp_customize->add_setting('beauty_parlour_slider_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'beauty_parlour_sanitize_select', ) ); $beauty_parlour_slider_section_hide_show_option = beauty_parlour_section_choice_option(); $wp_customize->add_control('beauty_parlour_slider_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Slider Option', 'beauty-parlour'), 'description' => esc_html__('Show/hide option for Slider Section.', 'beauty-parlour'), 'section' => 'sliderinfo', 'choices' => $beauty_parlour_slider_section_hide_show_option, 'priority' => 1 ) ); $beauty_parlour_slider_no = 3; for( $i = 1; $i <= $beauty_parlour_slider_no; $i++ ) { $beauty_parlour_slider_page = 'beauty_parlour_slider_page_' .$i; $beauty_parlour_slider_btntxt = 'beauty_parlour_slider_btntxt_' . $i; $beauty_parlour_slider_btnurl = 'beauty_parlour_slider_btnurl_' .$i; $wp_customize->add_setting( $beauty_parlour_slider_page, array( 'default' => 1, 'sanitize_callback' => 'beauty_parlour_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $beauty_parlour_slider_page, array( 'label' => esc_html__( 'Slider Page ', 'beauty-parlour' ) .$i, 'section' => 'sliderinfo', 'type' => 'dropdown-pages', 'priority' => 100, ) ); $wp_customize->add_setting( $beauty_parlour_slider_btntxt, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( $beauty_parlour_slider_btntxt, array( 'label' => esc_html__( 'Button Text','beauty-parlour' ), 'section' => 'sliderinfo', 'type' => 'text', 'priority' => 100, ) ); $wp_customize->add_setting( $beauty_parlour_slider_btnurl, array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( $beauty_parlour_slider_btnurl, array( 'label' => esc_html__( 'Button URL', 'beauty-parlour' ), 'section' => 'sliderinfo', 'type' => 'text', 'priority' => 100, ) ); } /** Slider Button Section Settings Start **/ $wp_customize->add_section('slider_info', array( 'title' => esc_html__('Slider Features Section', 'beauty-parlour'), 'description' => '', 'panel' => 'frontpage', 'priority' => 40 ) ); $wp_customize->add_setting( ' ', array( 'default' => 'show', 'sanitize_callback' => 'beauty_parlour_sanitize_select', ) ); $beauty_parlour_header_section_hide_show_option = beauty_parlour_section_choice_option(); $wp_customize->add_control('beauty_parlour_header_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Slider Features Option', 'beauty-parlour'), 'description' => esc_html__('Show/hide option for Header Section.', 'beauty-parlour'), 'section' => 'slider_info', 'choices' => $beauty_parlour_header_section_hide_show_option, 'priority' => 1 ) ); $wp_customize->add_setting('beauty_parlour_header_fa_link_1', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_header_fa_link_1', array( 'label' => esc_html__('Featured Icon 1', 'beauty-parlour'), 'section' => 'slider_info', 'description' => __('Select font awesome icon in list Font Awesome icons and enter the class name', 'beauty-parlour'), 'priority' => 2 ) ); $wp_customize->add_setting('beauty_parlour_header_feature_1', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_header_feature_1', array( 'label' => esc_html__('Feature 1', 'beauty-parlour'), 'section' => 'slider_info', 'priority' => 3 ) ); $wp_customize->add_setting('beauty_parlour_header_fa_link_2', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_header_fa_link_2', array( 'label' => esc_html__('Featured Icon 2', 'beauty-parlour'), 'section' => 'slider_info', 'description' => __('Select font awesome icon in list Font Awesome icons and enter the class name', 'beauty-parlour'), 'priority' => 4 ) ); $wp_customize->add_setting('beauty_parlour_header_feature_2', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_header_feature_2', array( 'label' => esc_html__('Feature 2', 'beauty-parlour'), 'section' => 'slider_info', 'priority' => 5 ) ); $wp_customize->add_setting('beauty_parlour_header_fa_link_3', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_header_fa_link_3', array( 'label' => esc_html__('Featured Icon 3', 'beauty-parlour'), 'section' => 'slider_info', 'description' => __('Select font awesome icon in list Font Awesome icons and enter the class name', 'beauty-parlour'), 'priority' => 6 ) ); $wp_customize->add_setting('beauty_parlour_header_feature_3', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_header_feature_3', array( 'label' => esc_html__('Feature 3', 'beauty-parlour'), 'section' => 'slider_info', 'priority' => 7 ) ); $wp_customize->add_setting('beauty_parlour_header_fa_link_4', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_header_fa_link_4', array( 'label' => esc_html__('Feature Icon 4', 'beauty-parlour'), 'section' => 'slider_info', 'description' => __('Select font awesome icon in list Font Awesome icons and enter the class name', 'beauty-parlour'), 'priority' => 8 ) ); $wp_customize->add_setting('beauty_parlour_header_feature_4', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_header_feature_4', array( 'label' => esc_html__('Feature 4', 'beauty-parlour'), 'section' => 'slider_info', 'priority' => 10 ) ); /** Service Section Settings Start **/ $wp_customize->add_section('services', array( 'title' => esc_html__('Service Section', 'beauty-parlour'), 'description' => '', 'panel' => 'frontpage', 'priority' => 140, ) ); $wp_customize->add_setting('beauty_parlour_services_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'beauty_parlour_sanitize_select', ) ); $beauty_parlour_services_section_hide_show_option = beauty_parlour_section_choice_option(); $wp_customize->add_control( 'beauty_parlour_services_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Services Option', 'beauty-parlour'), 'description' => esc_html__('Show/hide option Section.', 'beauty-parlour'), 'section' => 'services', 'choices' => $beauty_parlour_services_section_hide_show_option, 'priority' => 1 ) ); // Services title $wp_customize->add_setting('beauty_parlour_services_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_services_title', array( 'label' => esc_html__('service Title', 'beauty-parlour'), 'section' => 'services', 'priority' => 1 ) ); $wp_customize->add_setting('beauty_parlour_services_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_services_subtitle', array( 'label' => esc_html__('service description', 'beauty-parlour'), 'section' => 'services', 'priority' => 4 ) ); // column layout $wp_customize->add_setting('beauty_parlour_column_layout', array( 'default' => '4', 'sanitize_callback' => 'beauty_parlour_column_layout_sanitize_select', ) ); $beauty_parlour_services_column_layout = beauty_parlour_column_layout_option(); $wp_customize->add_control('beauty_parlour_column_layout', array( 'type' => 'radio', 'label' => esc_html__('Column Layout option ', 'beauty-parlour'), 'description' => '', 'section' => 'services', 'choices' => $beauty_parlour_services_column_layout, 'priority' => 2 ) ); // Services $beauty_parlour_service_no = 6; for( $i = 1; $i <= $beauty_parlour_service_no; $i++ ) { $beauty_parlour_servicepage = 'beauty_parlour_service_page_' . $i; $beauty_parlour_serviceicon = 'beauty_parlour_page_service_icon_' . $i; $wp_customize->add_setting( $beauty_parlour_servicepage, array( 'default' => 1, 'sanitize_callback' => 'beauty_parlour_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $beauty_parlour_servicepage, array( 'label' => esc_html__( 'Service Page ', 'beauty-parlour' ) .$i, 'section' => 'services', 'type' => 'dropdown-pages', 'priority' => 100, ) ); // Setting - Services Icon $wp_customize->add_setting( $beauty_parlour_serviceicon, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( $beauty_parlour_serviceicon, array( 'label' => esc_html__( 'Service Icon ', 'beauty-parlour' ).$i, 'description' => __('Select a icon in this list Font Awesome icons and enter the class name','beauty-parlour'), 'section' => 'services', 'type' => 'text', 'priority' => 100, ) ); } /** Service Section Settings End **/ /** Blog Section Settings Start **/ $wp_customize->add_section('beauty_parlour_blog_info', array( 'title' => esc_html__('Blog Section', 'beauty-parlour'), 'description' => '', 'panel' => 'frontpage', 'priority' => 160 ) ); $wp_customize->add_setting('beauty_parlour_blog_section_hideshow', array( 'default' => 'show', 'sanitize_callback' => 'beauty_parlour_sanitize_select', ) ); $beauty_parlour_blog_section_hide_show_option = beauty_parlour_section_choice_option(); $wp_customize->add_control('beauty_parlour_blog_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Blog Option', 'beauty-parlour'), 'description' => esc_html__('Show/hide option for Blog Section.', 'beauty-parlour'), 'section' => 'beauty_parlour_blog_info', 'choices' => $beauty_parlour_blog_section_hide_show_option, 'priority' => 1 ) ); $wp_customize->add_setting('beauty_parlour_blog_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_blog_title', array( 'label' => esc_html__('Blog Title', 'beauty-parlour'), 'section' => 'beauty_parlour_blog_info', 'priority' => 1 ) ); $wp_customize->add_setting('beauty_parlour_blog_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_blog_subtitle', array( 'label' => esc_html__('Blog Subheading', 'beauty-parlour'), 'section' => 'beauty_parlour_blog_info', 'priority' => 4 ) ); /** Blog Section Settings End **/ /** Client Section Settings Start **/ $wp_customize->add_section('clients_logo', array( 'title' => esc_html__('Clients logo Section', 'beauty-parlour'), 'description' => '', 'panel' => 'frontpage', 'priority' => 170 ) ); $wp_customize->add_setting('beauty_parlour_clients_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'beauty_parlour_sanitize_select', ) ); $beauty_parlour_section_choice_option = beauty_parlour_section_choice_option(); $wp_customize->add_control('beauty_parlour_clients_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Clients-logo', 'beauty-parlour'), 'description' => esc_html__('Show/hide option for Clients-logo Section.', 'beauty-parlour'), 'section' => 'clients_logo', 'choices' => $beauty_parlour_section_choice_option, 'priority' => 5 ) ); // Clients title $wp_customize->add_setting('beauty_parlour_clients_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('beauty_parlour_clients_title', array( 'label' => esc_html__('Clients Title', 'beauty-parlour'), 'section' => 'clients_logo', 'priority' => 7 ) ); $beauty_parlour_client_no = 4; for( $i = 1; $i <= $beauty_parlour_client_no; $i++ ) { $beauty_parlour_client_logo = 'beauty_parlour_client_logo_' . $i; $wp_customize->add_setting( $beauty_parlour_client_logo, array( 'default' => 1, 'sanitize_callback' => 'beauty_parlour_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $beauty_parlour_client_logo, array( 'label' => esc_html__( 'Client Page ', 'beauty-parlour' ) .$i, 'section' => 'clients_logo', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } /** Client Section Settings End **/ /** Callout Section Settings Start **/ $wp_customize->add_section( 'beauty_parlour_footer_contact', array( 'title' => esc_html__('Callout Section', 'beauty-parlour'), 'description' => '', 'panel' => 'frontpage', 'priority' => 170 ) ); $wp_customize->add_setting( 'beauty_parlour_contact_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'beauty_parlour_sanitize_select', ) ); $beauty_parlour_section_choice_option = beauty_parlour_section_choice_option(); $wp_customize->add_control( 'beauty_parlour_contact_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Footer Callout', 'beauty-parlour'), 'description' => esc_html__('Show/hide option for Footer Callout Section.', 'beauty-parlour'), 'section' => 'beauty_parlour_footer_contact', 'choices' => $beauty_parlour_section_choice_option, 'priority' => 5 ) ); $wp_customize->add_setting( 'beauty_parlour_ctah_heading', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'beauty_parlour_ctah_heading', array( 'label' => esc_html__('Callout Text', 'beauty-parlour'), 'section' => 'beauty_parlour_footer_contact', 'priority' => 8 ) ); $wp_customize->add_setting( 'beauty_parlour_ctah_btn_url', array( 'default' =>'', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'beauty_parlour_ctah_btn_url', array( 'label' => esc_html__('Button URL', 'beauty-parlour'), 'section' => 'beauty_parlour_footer_contact', 'priority' => 10 ) ); $wp_customize->add_setting( 'beauty_parlour_ctah_btn_text', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'beauty_parlour_ctah_btn_text', array( 'label' => esc_html__('Button Text', 'beauty-parlour'), 'section' => 'beauty_parlour_footer_contact', 'priority' => 12 ) ); /** Callout Section Settings End **/ /** Footer Section Settings Start **/ $wp_customize->add_section('beauty_parlour_footer_info', array( 'title' => esc_html__('Footer Section', 'beauty-parlour'), 'description' => '', 'panel' => 'frontpage', 'priority' => 180 ) ); $wp_customize->add_setting('beauty_parlour_footer_section_hideshow', array( 'default' => 'show', 'sanitize_callback' => 'beauty_parlour_sanitize_select', ) ); $beauty_parlour_footer_section_hide_show_option = beauty_parlour_section_choice_option(); $wp_customize->add_control('beauty_parlour_footer_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Footer Option', 'beauty-parlour'), 'description' => esc_html__('Show/hide option for Footer Section.', 'beauty-parlour'), 'section' => 'beauty_parlour_footer_info', 'choices' => $beauty_parlour_footer_section_hide_show_option, 'priority' => 1 ) ); $wp_customize->add_setting('beauty_parlour_footer_text', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'wp_kses_post' ) ); $wp_customize->add_control('beauty_parlour_footer_text', array( 'label' => esc_html__('Copyright', 'beauty-parlour'), 'section' => 'beauty_parlour_footer_info', 'type' => 'textarea', 'priority' => 2 )); /** Footer Section Settings End **/ } add_action( 'customize_register', 'beauty_parlour_customize_register' );