esc_html__('Show', 'ozone'), 'hide' => esc_html__('Hide', 'ozone') ); return apply_filters('ozone_section_choice_option', $ozone_section_choice_option); } endif; /** * Sanitizing the select callback example * */ if ( !function_exists('ozone_sanitize_select') ) : function ozone_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 ozone_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__('Ozone Options', 'ozone'), 'description' => '', 'priority' => 3, ) ); /** Slider Section Settings starts **/ // Panel - Slider Section 1 $wp_customize->add_section('sliderinfo', array( 'title' => esc_html__('Home Slider Section', 'ozone'), 'description' => '', 'panel' => 'frontpage', 'priority' => 140 ) ); $slider_no = 3; for( $i = 1; $i <= $slider_no; $i++ ) { $ozone_slider_page = 'ozone_slider_page_' .$i; $ozone_slider_btntxt = 'ozone_slider_btntxt_' . $i; $ozone_slider_btnurl = 'ozone_slider_btnurl_' .$i; $wp_customize->add_setting( $ozone_slider_page, array( 'default' => 1, 'sanitize_callback' => 'ozone_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $ozone_slider_page, array( 'label' => esc_html__( 'Slider Page ', 'ozone' ) .$i, 'section' => 'sliderinfo', 'type' => 'dropdown-pages', 'priority' => 100, ) ); $wp_customize->add_setting( $ozone_slider_btntxt, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( $ozone_slider_btntxt, array( 'label' => esc_html__( 'Slider Button Text','ozone' ), 'section' => 'sliderinfo', 'type' => 'text', 'priority' => 100, ) ); $wp_customize->add_setting( $ozone_slider_btnurl, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( $ozone_slider_btnurl, array( 'label' => esc_html__( 'Button URL', 'ozone' ), 'section' => 'sliderinfo', 'type' => 'text', 'priority' => 100, ) ); } /** Slider Section Settings end **/ // Services section if (!function_exists('ozone_col_layout_option')) : function ozone_col_layout_option() { $ozone_col_layout_option = array( '6' => esc_html__('2 Column Layout', 'ozone'), '4' => esc_html__('3 Column Layout', 'ozone'), '3' => esc_html__('4 Column Layout', 'ozone'), ); return apply_filters('ozone_col_layout_option', $ozone_col_layout_option); } endif; $wp_customize->add_section('services', array('title' => esc_html__('Home Service Section', 'ozone'), 'description' => '', 'panel' => 'frontpage', 'priority' => 140, ) ); $wp_customize->add_setting( 'ozone_services_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'ozone_sanitize_select', ) ); $ozone_services_section_hide_show_option = ozone_section_choice_option(); $wp_customize->add_control( 'ozone_services_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Services Option', 'ozone'), 'description' => esc_html__('Show/hide option Section.', 'ozone'), 'section' => 'services', 'choices' => $ozone_services_section_hide_show_option, 'priority' => 1 ) ); // column layout $wp_customize->add_setting( 'ozone_service_col_layout', array( 'default' => '4', 'sanitize_callback' => 'ozone_sanitize_select', ) ); $ozone_section_col_layout = ozone_col_layout_option(); $wp_customize->add_control( 'ozone_service_col_layout', array( 'type' => 'radio', 'label' => esc_html__('Column Layout option ', 'ozone'), 'description' => '', 'section' => 'services', 'choices' => $ozone_section_col_layout, 'priority' => 2 ) ); // Services title $wp_customize->add_setting('ozone-services_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('ozone-services_title', array( 'label' => esc_html__('Services Section Title', 'ozone'), 'section' => 'services', 'priority' => 3 ) ); $wp_customize->add_setting('ozone-services_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('ozone-services_subtitle', array( 'label' => esc_html__('Service Description', 'ozone'), 'section' => 'services', 'type' => 'text', 'priority' => 4 ) ); $service_no = 6; for( $i = 1; $i <= $service_no; $i++ ) { $ozone_servicepage = 'ozone_service_page_' . $i; $ozone_serviceicon = 'ozone_page_service_icon_' . $i; // Setting - Feature Icon $wp_customize->add_setting( $ozone_serviceicon, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( $ozone_serviceicon, array( 'label' => esc_html__( 'Service Icon ', 'ozone' ).$i, 'description' => __('Select a icon in this list Font Awesome icons and enter the class name','ozone'), 'section' => 'services', 'type' => 'text', 'priority' => 100, ) ); $wp_customize->add_setting( $ozone_servicepage, array( 'default' => 1, 'sanitize_callback' => 'ozone_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $ozone_servicepage, array( 'label' => esc_html__( 'Service Page ', 'ozone' ) .$i, 'section' => 'services', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } // About Us section $wp_customize->add_section('aboutus', array( 'title' => esc_html__('Home About Section', 'ozone'), 'description' => '', 'panel' => 'frontpage', 'priority' => 150, ) ); $wp_customize->add_setting( 'ozone_aboutus_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'ozone_sanitize_select', ) ); $ozone_aboutus_section_hide_show_option = ozone_section_choice_option(); $wp_customize->add_control('ozone_aboutus_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('About Us Option', 'ozone'), 'description' => esc_html__('Show/hide option for About Us Section.', 'ozone'), 'section' => 'aboutus', 'choices' => $ozone_aboutus_section_hide_show_option, 'priority' => 1 ) ); // About Us title $wp_customize->add_setting('ozone-about_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('ozone-about_title', array( 'label' => esc_html__('About Title', 'ozone'), 'section' => 'aboutus', 'priority' => 1 ) ); $wp_customize->add_setting('ozone-about_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('ozone-about_subtitle', array( 'label' => esc_html__('About description', 'ozone'), 'section' => 'aboutus', 'type' => 'text', 'priority' => 4 ) ); $about_no = 1; for( $i = 1; $i <= $about_no; $i++ ) { $ozone_about_page = 'ozone_about_page_' .$i; $wp_customize->add_setting( $ozone_about_page, array( 'default' => 1, 'sanitize_callback' => 'ozone_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $ozone_about_page, array( 'label' => esc_html__( 'About Page ', 'ozone' ) .$i, 'section' => 'aboutus', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } // Projects section $wp_customize->add_section( 'projects', array( 'title' => esc_html__('Project Section', 'ozone'), 'description' => '', 'panel' => 'frontpage', 'priority' => 160, ) ); $wp_customize->add_setting( 'ozone_projects_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'ozone_sanitize_select', ) ); $ozone_section_choice_option = ozone_section_choice_option(); $wp_customize->add_control( 'ozone_projects_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Projects Option', 'ozone'), 'description' => esc_html__('Show/hide option Section.', 'ozone'), 'section' => 'projects', 'choices' => $ozone_section_choice_option, 'priority' => 1 ) ); $wp_customize->add_setting( 'ozone-projects_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'ozone-projects_title', array( 'label' => esc_html__('Projects Section Title', 'ozone'), 'section' => 'projects', 'priority' => 3 ) ); $wp_customize->add_setting( 'ozone-projects_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'ozone-projects_subtitle', array( 'label' => esc_html__('Projects Description', 'ozone'), 'section' => 'projects', 'priority' => 4 ) ); $projects_no = 6; for( $i = 1; $i <= $projects_no; $i++ ) { $ozone_projectspage = 'ozone_projects_page_' . $i; $wp_customize->add_setting( $ozone_projectspage, array( 'default' => 1, 'sanitize_callback' => 'ozone_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $ozone_projectspage, array( 'label' => esc_html__( 'Projects Page ', 'ozone' ) .$i, 'section' => 'projects', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } // Blog section $wp_customize->add_section('ozone-blog_info', array( 'title' => esc_html__('Home Blog Section', 'ozone'), 'description' => '', 'panel' => 'frontpage', 'priority' => 170 ) ); $wp_customize->add_setting('ozone_blog_section_hideshow', array( 'default' => 'show', 'sanitize_callback' => 'ozone_sanitize_select', ) ); $ozone_blog_section_hide_show_option = ozone_section_choice_option(); $wp_customize->add_control('ozone_blog_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Blog Option', 'ozone'), 'description' => esc_html__('Show/hide option for Blog Section.', 'ozone'), 'section' => 'ozone-blog_info', 'choices' => $ozone_blog_section_hide_show_option, 'priority' => 1 ) ); $wp_customize->add_setting('ozone_blog_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('ozone_blog_title', array( 'label' => esc_html__('Blog Title', 'ozone'), 'section' => 'ozone-blog_info', 'priority' => 1 ) ); $wp_customize->add_setting('ozone-blog_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('ozone-blog_subtitle', array( 'label' => esc_html__('Service Description', 'ozone'), 'section' => 'ozone-blog_info', 'type' => 'text', 'priority' => 2 ) ); $wp_customize->add_setting( 'ozone_blog_btntxt', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'ozone_blog_btntxt', array( 'label' => esc_html__( 'Button Text','ozone' ), 'section' => 'ozone-blog_info', 'type' => 'text', 'priority' => 100, ) ); $wp_customize->add_setting( 'ozone_blog_btnurl', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'ozone_blog_btnurl', array( 'label' => esc_html__( 'Button URL', 'ozone' ), 'section' => 'ozone-blog_info', 'type' => 'text', 'priority' => 100, ) ); //callout $wp_customize->add_section('ozone_footer_contact', array( 'title' => esc_html__('Callout Section', 'ozone'), 'description' => '', 'panel' => 'frontpage', 'priority' => 170 ) ); $wp_customize->add_setting('ozone_contact_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'ozone_sanitize_select', ) ); $ozone_contact_s_hideshow = ozone_section_choice_option(); $wp_customize->add_control('ozone_contact_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Footer Callout', 'ozone'), 'description' => esc_html__('Show/hide option for Footer Callout Section.', 'ozone'), 'section' => 'ozone_footer_contact', 'choices' => $ozone_contact_s_hideshow, '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 Text', 'ozone'), 'section' => 'ozone_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', 'ozone'), 'section' => 'ozone_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', 'ozone'), 'section' => 'ozone_footer_contact', 'priority' => 12 ) ); // Footer Section $wp_customize->add_section('ozone-footer_info', array( 'title' => esc_html__('Footer Section', 'ozone'), 'description' => '', 'panel' => 'frontpage', 'priority' => 170 ) ); $wp_customize->add_setting('ozone_footer_section_hideshow', array( 'default' => 'show', 'sanitize_callback' => 'ozone_sanitize_select', ) ); $ozone_footer_section_hide_show_option = ozone_section_choice_option(); $wp_customize->add_control('ozone_footer_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Footer Option', 'ozone'), 'description' => esc_html__('Show/hide option for Footer Section.', 'ozone'), 'section' => 'ozone-footer_info', 'choices' => $ozone_footer_section_hide_show_option, 'priority' => 1 ) ); $wp_customize->add_setting('ozone-footer_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'wp_kses_post' ) ); $wp_customize->add_control('ozone-footer_title', array( 'label' => esc_html__('Copyright', 'ozone'), 'section' => 'ozone-footer_info', 'type' => 'textarea', 'priority' => 1 ) ); /** Front Page Section Settings end **/ } add_action( 'customize_register', 'ozone_customize_register' );