esc_html__('Show', 'bodyfit'), 'hide' => esc_html__('Hide', 'bodyfit') ); return apply_filters('bodyfit_section_choice_option', $bodyfit_section_choice_option); } endif; /** * Sanitizing the select callback example * */ if ( !function_exists('bodyfit_sanitize_select') ) : function bodyfit_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 bodyfit_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__('Bodyfit Options', 'bodyfit'), 'description' => '', 'priority' => 3, ) ); /** Header Section Settings Start **/ $wp_customize->add_section('header_info', array( 'title' => esc_html__('Header Section', 'bodyfit'), 'description' => '', 'panel' => 'frontpage', 'priority' => 40 ) ); $wp_customize->add_setting( 'bodyfit_header_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'bodyfit_sanitize_select', ) ); $bodyfit_header_section_hide_show_option = bodyfit_section_choice_option(); $wp_customize->add_control('bodyfit_header_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Header Option', 'bodyfit'), 'description' => esc_html__('Show/hide option for Header Section.', 'bodyfit'), 'section' => 'header_info', 'choices' => $bodyfit_header_section_hide_show_option, 'priority' => 1 ) ); $wp_customize->add_setting('bodyfit_header_hours_value', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('bodyfit_header_hours_value', array( 'label' => esc_html__('Opening Hours', 'bodyfit'), 'section' => 'header_info', 'priority' => 2 ) ); $wp_customize->add_setting('bodyfit_header_phone_value', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('bodyfit_header_phone_value', array( 'label' => esc_html__('Contact', 'bodyfit'), 'section' => 'header_info', 'priority' => 3 ) ); $wp_customize->add_setting('bodyfit_header_email_value', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('bodyfit_header_email_value', array( 'label' => esc_html__('Email', 'bodyfit'), 'section' => 'header_info', 'priority' => 3 ) ); $wp_customize->add_setting('bodyfit_header_social_link_1', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control('bodyfit_header_social_link_1', array( 'label' => esc_html__('Facebook URL', 'bodyfit'), 'section' => 'header_info', 'priority' => 3 ) ); $wp_customize->add_setting('bodyfit_header_social_link_2', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control('bodyfit_header_social_link_2', array( 'label' => esc_html__('Twitter URL', 'bodyfit'), 'section' => 'header_info', 'priority' => 3 ) ); $wp_customize->add_setting('bodyfit_header_social_link_3', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control('bodyfit_header_social_link_3', array( 'label' => esc_html__('Linkedin URL', 'bodyfit'), 'section' => 'header_info', 'priority' => 3 ) ); $wp_customize->add_setting('bodyfit_header_social_link_4', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control('bodyfit_header_social_link_4', array( 'label' => esc_html__('Youtube URL', 'bodyfit'), 'section' => 'header_info', 'priority' => 3 ) ); $wp_customize->add_setting('bodyfit_header_social_link_5', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control('bodyfit_header_social_link_5', array( 'label' => esc_html__('Instagram URL', 'bodyfit'), 'section' => 'header_info', 'priority' => 3 ) ); /** Header Section Settings end **/ /** Slider Section Settings starts **/ // Panel - Slider Section 1 $wp_customize->add_section('sliderinfo', array( 'title' => esc_html__('Home Slider Section', 'bodyfit'), 'description' => '', 'panel' => 'frontpage', 'priority' => 140 ) ); // hide show $wp_customize->add_setting('bodyfit_slider_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'bodyfit_sanitize_select', ) ); $bodyfit_section_choice_option = bodyfit_section_choice_option(); $wp_customize->add_control( 'bodyfit_slider_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Slider Option', 'bodyfit'), 'description' => esc_html__('Show/hide option for Slider Section.', 'bodyfit'), 'section' => 'sliderinfo', 'choices' => $bodyfit_section_choice_option, 'priority' => 1 ) ); $bodyfit_slider_no = 3; for( $i = 1; $i <= $bodyfit_slider_no; $i++ ) { $bodyfit_slider_page = 'bodyfit_slider_page_' .$i; $bodyfit_slider_btntxt = 'bodyfit_slider_btntxt_' . $i; $bodyfit_slider_btnurl = 'bodyfit_slider_btnurl_' .$i; $wp_customize->add_setting( $bodyfit_slider_page, array( 'default' => 1, 'sanitize_callback' => 'bodyfit_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $bodyfit_slider_page, array( 'label' => esc_html__( 'Slider Page ', 'bodyfit' ) .$i, 'section' => 'sliderinfo', 'type' => 'dropdown-pages', 'priority' => 100, ) ); $wp_customize->add_setting( $bodyfit_slider_btntxt, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( $bodyfit_slider_btntxt, array( 'label' => esc_html__( 'Slider Button Text','bodyfit' ), 'section' => 'sliderinfo', 'type' => 'text', 'priority' => 100, ) ); $wp_customize->add_setting( $bodyfit_slider_btnurl, array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( $bodyfit_slider_btnurl, array( 'label' => esc_html__( 'Button URL', 'bodyfit' ), 'section' => 'sliderinfo', 'priority' => 100, ) ); } /** Slider Section Settings end **/ /** Features Section Settings Start **/ $wp_customize->add_section('features', array( 'title' => esc_html__('Features Section', 'bodyfit'), 'description' => '', 'panel' => 'frontpage', 'priority' => 140, ) ); $wp_customize->add_setting('bodyfit_features_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'bodyfit_sanitize_select', ) ); $bodyfit_features_section_hide_show_option = bodyfit_section_choice_option(); $wp_customize->add_control( 'bodyfit_features_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Features Option', 'bodyfit'), 'description' => esc_html__('Show/hide option for Features Section.', 'bodyfit'), 'section' => 'features', 'choices' => $bodyfit_features_section_hide_show_option, 'priority' => 1 ) ); // features $bodyfit_features_no = 4; for( $i = 1; $i <= $bodyfit_features_no; $i++ ) { $bodyfit_featurespage = 'bodyfit_features_page_' . $i; // Setting - Feature Page $wp_customize->add_setting( $bodyfit_featurespage, array( 'default' => 1, 'sanitize_callback' => 'bodyfit_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $bodyfit_featurespage, array( 'label' => esc_html__( 'Features Page ', 'bodyfit' ) .$i, 'section' => 'features', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } /** Features Section Settings End **/ /** Aboutus Section Settings Start **/ $wp_customize->add_section('aboutus', array( 'title' => esc_html__('About Us Section', 'bodyfit'), 'description' => '', 'panel' => 'frontpage', 'priority' => 140, ) ); $wp_customize->add_setting('bodyfit_aboutus_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'bodyfit_sanitize_select', ) ); $bodyfit_aboutus_section_hide_show_option = bodyfit_section_choice_option(); $wp_customize->add_control('bodyfit_aboutus_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('About Us Option', 'bodyfit'), 'description' => esc_html__('Show/hide option for About Section.', 'bodyfit'), 'section' => 'aboutus', 'choices' => $bodyfit_aboutus_section_hide_show_option, 'priority' => 1 ) ); // About Us Title $wp_customize->add_setting('bodyfit_aboutus_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('bodyfit_aboutus_title', array( 'label' => esc_html__('About Us Title', 'bodyfit'), 'section' => 'aboutus', 'priority' => 1 ) ); $wp_customize->add_setting('bodyfit_aboutus_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('bodyfit_aboutus_subtitle', array( 'label' => esc_html__('About Us Title', 'bodyfit'), 'section' => 'aboutus', 'priority' => 1 ) ); // About Us $wp_customize->add_setting( 'bodyfit_aboutus_page', array( 'default' => 1, 'sanitize_callback' => 'bodyfit_sanitize_dropdown_pages', ) ); $wp_customize->add_control( 'bodyfit_aboutus_page', array( 'label' => esc_html__( 'About Us Page ', 'bodyfit' ) , 'section' => 'aboutus', 'type' => 'dropdown-pages', 'priority' => 100, ) ); /** About Us Section Settings End **/ // Services section if (!function_exists('bodyfit_col_layout_option')) : function bodyfit_col_layout_option() { $bodyfit_col_layout_option = array( '6' => esc_html__('2 Column Layout', 'bodyfit'), '4' => esc_html__('3 Column Layout', 'bodyfit'), '3' => esc_html__('4 Column Layout', 'bodyfit'), ); return apply_filters('bodyfit_col_layout_option', $bodyfit_col_layout_option); } endif; $wp_customize->add_section( 'services', array( 'title' => esc_html__('Home Service Section', 'bodyfit'), 'description' => '', 'panel' => 'frontpage', 'priority' => 140, ) ); $wp_customize->add_setting( 'bodyfit_services_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'bodyfit_sanitize_select', ) ); $bodyfit_section_choice_option = bodyfit_section_choice_option(); $wp_customize->add_control( 'bodyfit_services_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Services Option', 'bodyfit'), 'description' => esc_html__('Show/hide option Section.', 'bodyfit'), 'section' => 'services', 'choices' => $bodyfit_section_choice_option, 'priority' => 1 ) ); // column layout $wp_customize->add_setting( 'bodyfit_service_col_layout', array( 'default' => '4', 'sanitize_callback' => 'bodyfit_sanitize_select', ) ); $bodyfit_section_col_layout = bodyfit_col_layout_option(); $wp_customize->add_control( 'bodyfit_service_col_layout', array( 'type' => 'radio', 'label' => esc_html__('Column Layout option ', 'bodyfit'), 'description' => '', 'section' => 'services', 'choices' => $bodyfit_section_col_layout, 'priority' => 2 ) ); $wp_customize->add_setting( 'bodyfit-projects_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'bodyfit-services_title', array( 'label' => esc_html__('Services Section Title', 'bodyfit'), 'section' => 'services', 'priority' => 3 ) ); $wp_customize->add_setting( 'bodyfit-services_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'bodyfit-services_subtitle', array( 'label' => esc_html__('Services Description', 'bodyfit'), 'section' => 'services', 'priority' => 4 ) ); $bodyfit_service_no = 8; for( $i = 1; $i <= $bodyfit_service_no; $i++ ) { $bodyfit_servicepage = 'bodyfit_service_page_' . $i; $bodyfit_serviceicon = 'bodyfit_page_service_icon_' . $i; // Setting - Feature Icon $wp_customize->add_setting( $bodyfit_serviceicon, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( $bodyfit_serviceicon, array( 'label' => esc_html__( 'Service Icon ', 'bodyfit' ).$i, 'description' => __('Select a icon in this list Font Awesome icons and enter the class name','bodyfit'), 'section' => 'services', 'type' => 'text', 'priority' => 100, ) ); $wp_customize->add_setting( $bodyfit_servicepage, array( 'default' => 1, 'sanitize_callback' => 'bodyfit_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $bodyfit_servicepage, array( 'label' => esc_html__( 'Service Page ', 'bodyfit' ) .$i, 'section' => 'services', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } // Projects section $wp_customize->add_section( 'projects', array( 'title' => esc_html__('Project Section', 'bodyfit'), 'description' => '', 'panel' => 'frontpage', 'priority' => 160, ) ); $wp_customize->add_setting( 'bodyfit_projects_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'bodyfit_sanitize_select', ) ); $bodyfit_section_choice_option = bodyfit_section_choice_option(); $wp_customize->add_control( 'bodyfit_projects_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Projects Option', 'bodyfit'), 'description' => esc_html__('Show/hide option Section.', 'bodyfit'), 'section' => 'projects', 'choices' => $bodyfit_section_choice_option, 'priority' => 1 ) ); $wp_customize->add_setting( 'bodyfit-projects_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'bodyfit-projects_title', array( 'label' => esc_html__('Projects Section Title', 'bodyfit'), 'section' => 'projects', 'priority' => 3 ) ); $wp_customize->add_setting( 'bodyfit-projects_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'bodyfit-projects_subtitle', array( 'label' => esc_html__('Projects Description', 'bodyfit'), 'section' => 'projects', 'priority' => 4 ) ); $bodyfit_projects_no = 8; for( $i = 1; $i <= $bodyfit_projects_no; $i++ ) { $bodyfit_projectspage = 'bodyfit_projects_page_' . $i; $wp_customize->add_setting( $bodyfit_projectspage, array( 'default' => 1, 'sanitize_callback' => 'bodyfit_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $bodyfit_projectspage, array( 'label' => esc_html__( 'Projects Page ', 'bodyfit' ) .$i, 'section' => 'projects', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } // Blog section $wp_customize->add_section( 'bodyfit-blog_info', array( 'title' => esc_html__('Home Blog Section', 'bodyfit'), 'description' => '', 'panel' => 'frontpage', 'priority' => 170 ) ); $wp_customize->add_setting( 'bodyfit_blog_section_hideshow', array( 'default' => 'show', 'sanitize_callback' => 'bodyfit_sanitize_select', ) ); $bodyfit_section_choice_option = bodyfit_section_choice_option(); $wp_customize->add_control( 'bodyfit_blog_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Blog Option', 'bodyfit'), 'description' => esc_html__('Show/hide option for Blog Section.', 'bodyfit'), 'section' => 'bodyfit-blog_info', 'choices' => $bodyfit_section_choice_option, 'priority' => 1 ) ); $wp_customize->add_setting( 'bodyfit_blog_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'bodyfit_blog_title', array( 'label' => esc_html__('Blog Title', 'bodyfit'), 'section' => 'bodyfit-blog_info', 'priority' => 1 ) ); $wp_customize->add_setting('bodyfit-blog_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('bodyfit-blog_subtitle', array( 'label' => esc_html__('Blog Description', 'bodyfit'), 'section' => 'bodyfit-blog_info', 'type' => 'text', 'priority' => 2 ) ); // Callout section $wp_customize->add_section( 'bodyfit_footer_contact', array( 'title' => esc_html__('Callout Section', 'bodyfit'), 'description' => '', 'panel' => 'frontpage', 'priority' => 150 ) ); $wp_customize->add_setting( 'bodyfit_contact_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'bodyfit_sanitize_select', ) ); $bodyfit_section_choice_option = bodyfit_section_choice_option(); $wp_customize->add_control( 'bodyfit_contact_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Callout', 'bodyfit'), 'description' => esc_html__('Show/hide option for Footer Callout Section.', 'bodyfit'), 'section' => 'bodyfit_footer_contact', 'choices' => $bodyfit_section_choice_option, 'priority' => 5 ) ); $wp_customize->add_setting( 'ctah_heading', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'ctah_heading', array( 'label' => esc_html__('Callout Title', 'bodyfit'), 'section' => 'bodyfit_footer_contact', 'priority' => 8 ) ); $wp_customize->add_setting( 'ctah_subheading', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'ctah_subheading', array( 'label' => esc_html__('Callout subtitle', 'bodyfit'), 'section' => 'bodyfit_footer_contact', 'priority' => 8 ) ); $wp_customize->add_setting( 'ctah_btn_url', array( 'default' =>'', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'ctah_btn_url', array( 'label' => esc_html__('Button URL', 'bodyfit'), 'section' => 'bodyfit_footer_contact', 'priority' => 10 ) ); $wp_customize->add_setting( 'ctah_btn_text', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'ctah_btn_text', array( 'label' => esc_html__('Button Text', 'bodyfit'), 'section' => 'bodyfit_footer_contact', 'priority' => 12 ) ); // clients logo info $wp_customize->add_section( 'clients_logo', array( 'title' => esc_html__('Clients logo Section', 'bodyfit'), 'description' => '', 'panel' => 'frontpage', 'priority' => 170 ) ); $wp_customize->add_setting( 'bodyfit_clients_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'bodyfit_sanitize_select', ) ); $bodyfit_section_choice_option = bodyfit_section_choice_option(); $wp_customize->add_control( 'bodyfit_clients_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Clients-logo', 'bodyfit'), 'description' => esc_html__('Show/hide option for Clients-logo Section.', 'bodyfit'), 'section' => 'clients_logo', 'choices' => $bodyfit_section_choice_option, 'priority' => 5 ) ); // Clients title $wp_customize->add_setting( 'bodyfit_clients_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'bodyfit_clients_title', array( 'label' => esc_html__('Clients logo Section Title', 'bodyfit'), 'section' => 'clients_logo', 'priority' => 6 ) ); $wp_customize->add_setting('bodyfit-clients_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('bodyfit-clients_subtitle', array( 'label' => esc_html__('Clients Description', 'bodyfit'), 'section' => 'clients_logo', 'type' => 'text', 'priority' => 6 ) ); $bodyfit_client_no = 5; for( $i = 1; $i <= $bodyfit_client_no; $i++ ) { $bodyfit_client_logo = 'bodyfit_client_logo_' . $i; $wp_customize->add_setting( $bodyfit_client_logo, array( 'default' => 1, 'sanitize_callback' => 'bodyfit_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $bodyfit_client_logo, array( 'label' => esc_html__( 'Client Page ', 'bodyfit' ) .$i, 'section' => 'clients_logo', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } // Footer Section $wp_customize->add_section( 'bodyfit-footer_info', array( 'title' => esc_html__('Footer Section', 'bodyfit'), 'description' => '', 'panel' => 'frontpage', 'priority' => 170 ) ); $wp_customize->add_setting( 'bodyfit_footer_section_hideshow', array( 'default' => 'show', 'sanitize_callback' => 'bodyfit_sanitize_select', ) ); $bodyfit_section_choice_option = bodyfit_section_choice_option(); $wp_customize->add_control( 'bodyfit_footer_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Footer Option', 'bodyfit'), 'description' => esc_html__('Show/hide option for Footer Section.', 'bodyfit'), 'section' => 'bodyfit-footer_info', 'choices' => $bodyfit_section_choice_option, 'priority' => 1 ) ); $wp_customize->add_setting( 'bodyfit-footer_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'wp_kses_post' ) ); $wp_customize->add_control( 'bodyfit-footer_title', array( 'label' => esc_html__('Copyright', 'bodyfit'), 'section' => 'bodyfit-footer_info', 'type' => 'textarea', 'priority' => 1 ) ); /** Front Page Section Settings end **/ } add_action( 'customize_register', 'bodyfit_customize_register' );