esc_html__('Show', 'munix'), 'hide' => esc_html__('Hide', 'munix') ); return apply_filters('munix_section_choice_option', $munix_section_choice_option); } endif; if (!function_exists('munix_column_layout_option')) : function munix_column_layout_option() { $munix_column_layout_option = array( '6' => esc_html__('2 Column Layout', 'munix'), '4' => esc_html__('3 Column Layout', 'munix'), '3' => esc_html__('4 Column Layout', 'munix'), ); return apply_filters('munix_column_layout_option', $munix_column_layout_option); } endif; /** * Sanitizing the select callback example * */ if ( !function_exists('munix_sanitize_select') ) : function munix_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('munix_column_layout_sanitize_select') ) : function munix_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('munix_column_layout_sanitize_select') ) : function munix_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 munix_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__('munix Options', 'munix'), 'description' => '', 'priority' => 3, ) ); /** Header Section Settings Start **/ $wp_customize->add_section('header_info', array( 'title' => esc_html__('Header Section', 'munix'), 'description' => '', 'panel' => 'frontpage', 'priority' => 40 ) ); $wp_customize->add_setting( 'munix_header_section_hideshow', array( 'default' => 'show', 'sanitize_callback' => 'munix_sanitize_select', ) ); $munix_header_section_hide_show_option = munix_section_choice_option(); $wp_customize->add_control('munix_header_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Header Option', 'munix'), 'description' => esc_html__('Show/hide option for Header Section.', 'munix'), 'section' => 'header_info', 'choices' => $munix_header_section_hide_show_option, 'priority' => 1 ) ); $wp_customize->add_setting('munix_header_email_value', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('munix_header_email_value', array( 'label' => esc_html__('Email', 'munix'), 'section' => 'header_info', 'priority' => 3 ) ); $wp_customize->add_setting('munix_header_phone_value', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('munix_header_phone_value', array( 'label' => esc_html__('Contact', 'munix'), 'section' => 'header_info', 'priority' => 4 ) ); $wp_customize->add_setting('munix_header_address_value', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('munix_header_address_value', array( 'label' => esc_html__('Address', 'munix'), 'section' => 'header_info', 'priority' => 2 ) ); $wp_customize->add_setting('munix_header_social_link_1', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control('munix_header_social_link_1', array( 'label' => esc_html__('Facebook URL', 'munix'), 'section' => 'header_info', 'priority' => 1 ) ); $wp_customize->add_setting('munix_header_social_link_2', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control('munix_header_social_link_2', array( 'label' => esc_html__('Twitter URL', 'munix'), 'section' => 'header_info', 'priority' => 1 ) ); $wp_customize->add_setting('munix_header_social_link_3', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control('munix_header_social_link_3', array( 'label' => esc_html__('Linkedin URL', 'munix'), 'section' => 'header_info', 'priority' => 1 ) ); $wp_customize->add_setting('munix_header_social_link_4', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control('munix_header_social_link_4', array( 'label' => esc_html__('Instagram URL', 'munix'), 'section' => 'header_info', 'priority' => 1 ) ); $wp_customize->add_setting('munix_header_social_link_5', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control('munix_header_social_link_5', array( 'label' => esc_html__('Google-plus URL', 'munix'), 'section' => 'header_info', 'priority' => 1 ) ); /** Header Section Settings end **/ /** Slider Section Settings Start **/ // Panel - Slider Section 1 $wp_customize->add_section('sliderinfo', array( 'title' => esc_html__('Slider Section', 'munix'), 'description' => '', 'panel' => 'frontpage', 'priority' => 130 ) ); // hide show $wp_customize->add_setting('munix_slider_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'munix_sanitize_select', ) ); $munix_slider_section_hide_show_option = munix_section_choice_option(); $wp_customize->add_control('munix_slider_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Slider Option', 'munix'), 'description' => esc_html__('Show/hide option for Slider Section.', 'munix'), 'section' => 'sliderinfo', 'choices' => $munix_slider_section_hide_show_option, 'priority' => 1 ) ); $munix_slider_no = 3; for( $i = 1; $i <= $munix_slider_no; $i++ ) { $munix_slider_page = 'munix_slider_page_' .$i; $munix_slider_btntxt = 'munix_slider_btntxt_' . $i; $munix_slider_btnurl = 'munix_slider_btnurl_' .$i; $wp_customize->add_setting( $munix_slider_page, array( 'default' => 1, 'sanitize_callback' => 'munix_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $munix_slider_page, array( 'label' => esc_html__( 'Slider Page ', 'munix' ) .$i, 'section' => 'sliderinfo', 'type' => 'dropdown-pages', 'priority' => 100, ) ); $wp_customize->add_setting( $munix_slider_btntxt, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( $munix_slider_btntxt, array( 'label' => esc_html__( 'Button Text','munix' ), 'section' => 'sliderinfo', 'type' => 'text', 'priority' => 100, ) ); $wp_customize->add_setting( $munix_slider_btnurl, array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( $munix_slider_btnurl, array( 'label' => esc_html__( 'Button URL', 'munix' ), 'section' => 'sliderinfo', 'type' => 'text', 'priority' => 100, ) ); } /** Slider Section Settings End **/ /** Service Section Settings Start **/ $wp_customize->add_section('services', array( 'title' => esc_html__('Service Section', 'munix'), 'description' => '', 'panel' => 'frontpage', 'priority' => 140, ) ); $wp_customize->add_setting('munix_services_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'munix_sanitize_select', ) ); $munix_services_section_hide_show_option = munix_section_choice_option(); $wp_customize->add_control( 'munix_services_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Services Option', 'munix'), 'description' => esc_html__('Show/hide option Section.', 'munix'), 'section' => 'services', 'choices' => $munix_services_section_hide_show_option, 'priority' => 1 ) ); // Services title $wp_customize->add_setting('munix_services_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('munix_services_title', array( 'label' => esc_html__('service Title', 'munix'), 'section' => 'services', 'priority' => 1 ) ); $wp_customize->add_setting('munix_services_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('munix_services_subtitle', array( 'label' => esc_html__('service description', 'munix'), 'section' => 'services', 'priority' => 4 ) ); // column layout $wp_customize->add_setting('munix_column_layout', array( 'default' => '4', 'sanitize_callback' => 'munix_column_layout_sanitize_select', ) ); $munix_services_column_layout = munix_column_layout_option(); $wp_customize->add_control('munix_column_layout', array( 'type' => 'radio', 'label' => esc_html__('Column Layout option ', 'munix'), 'description' => '', 'section' => 'services', 'choices' => $munix_services_column_layout, 'priority' => 2 ) ); // Services $munix_service_no = 6; for( $i = 1; $i <= $munix_service_no; $i++ ) { $munix_servicepage = 'munix_service_page_' . $i; $munix_serviceicon = 'munix_page_service_icon_' . $i; $wp_customize->add_setting( $munix_servicepage, array( 'default' => 1, 'sanitize_callback' => 'munix_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $munix_servicepage, array( 'label' => esc_html__( 'Service Page ', 'munix' ) .$i, 'section' => 'services', 'type' => 'dropdown-pages', 'priority' => 100, ) ); // Setting - Services Icon $wp_customize->add_setting( $munix_serviceicon, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( $munix_serviceicon, array( 'label' => esc_html__( 'Service Icon ', 'munix' ).$i, 'description' => __('Select a icon in this list Font Awesome icons and enter the class name','munix'), 'section' => 'services', 'type' => 'text', 'priority' => 100, ) ); } /** Service Section Settings End **/ /** Portfolio Section Settings Start **/ $wp_customize->add_section('portfolio', array( 'title' => esc_html__('Portfolio Section', 'munix'), 'description' => '', 'panel' => 'frontpage', 'priority' => 140, ) ); $wp_customize->add_setting('munix_portfolio_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'munix_sanitize_select', ) ); $munix_portfolio_section_hide_show_option = munix_section_choice_option(); $wp_customize->add_control('munix_portfolio_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Portfolio Option', 'munix'), 'description' => esc_html__('Show/hide option Section.', 'munix'), 'section' => 'portfolio', 'choices' => $munix_portfolio_section_hide_show_option, 'priority' => 1 ) ); // Portfolio title $wp_customize->add_setting('munix_portfolio_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('munix_portfolio_title', array( 'label' => esc_html__('Portfolio Title', 'munix'), 'section' => 'portfolio', 'priority' => 1 ) ); $wp_customize->add_setting('munix_portfolio_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('munix_portfolio_subtitle', array( 'label' => esc_html__('Portfolio Description', 'munix'), 'section' => 'portfolio', 'priority' => 4 ) ); // Portfolio $munix_portfolio_no = 6; for( $i = 1; $i <= $munix_portfolio_no; $i++ ) { $munix_portfoliopage = 'munix_portfolio_page_' . $i; $wp_customize->add_setting( $munix_portfoliopage, array( 'default' => 1, 'sanitize_callback' => 'munix_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $munix_portfoliopage, array( 'label' => esc_html__( 'Portfolio Page ', 'munix' ) .$i, 'section' => 'portfolio', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } /** Portfolio Section Settings End **/ /** Blog Section Settings Start **/ $wp_customize->add_section('munix_blog_info', array( 'title' => esc_html__('Blog Section', 'munix'), 'description' => '', 'panel' => 'frontpage', 'priority' => 160 ) ); $wp_customize->add_setting('munix_blog_section_hideshow', array( 'default' => 'show', 'sanitize_callback' => 'munix_sanitize_select', ) ); $munix_blog_section_hide_show_option = munix_section_choice_option(); $wp_customize->add_control('munix_blog_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Blog Option', 'munix'), 'description' => esc_html__('Show/hide option for Blog Section.', 'munix'), 'section' => 'munix_blog_info', 'choices' => $munix_blog_section_hide_show_option, 'priority' => 1 ) ); $wp_customize->add_setting('munix_blog_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('munix_blog_title', array( 'label' => esc_html__('Blog Title', 'munix'), 'section' => 'munix_blog_info', 'priority' => 1 ) ); $wp_customize->add_setting('munix_blog_subtitle', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('munix_blog_subtitle', array( 'label' => esc_html__('Blog Subheading', 'munix'), 'section' => 'munix_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', 'munix'), 'description' => '', 'panel' => 'frontpage', 'priority' => 170 ) ); $wp_customize->add_setting('munix_clients_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'munix_sanitize_select', ) ); $munix_section_choice_option = munix_section_choice_option(); $wp_customize->add_control('munix_clients_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Clients-logo', 'munix'), 'description' => esc_html__('Show/hide option for Clients-logo Section.', 'munix'), 'section' => 'clients_logo', 'choices' => $munix_section_choice_option, 'priority' => 5 ) ); // Clients title $wp_customize->add_setting('munix_clients_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('munix_clients_title', array( 'label' => esc_html__('Clients Title', 'munix'), 'section' => 'clients_logo', 'priority' => 7 ) ); $munix_client_no = 4; for( $i = 1; $i <= $munix_client_no; $i++ ) { $munix_client_logo = 'munix_client_logo_' . $i; $wp_customize->add_setting( $munix_client_logo, array( 'default' => 1, 'sanitize_callback' => 'munix_sanitize_dropdown_pages', ) ); $wp_customize->add_control( $munix_client_logo, array( 'label' => esc_html__( 'Client Page ', 'munix' ) .$i, 'section' => 'clients_logo', 'type' => 'dropdown-pages', 'priority' => 100, ) ); } /** Client Section Settings End **/ /** Callout Section Settings Start **/ $wp_customize->add_section( 'munix_footer_contact', array( 'title' => esc_html__('Callout Section', 'munix'), 'description' => '', 'panel' => 'frontpage', 'priority' => 170 ) ); $wp_customize->add_setting( 'munix_contact_section_hideshow', array( 'default' => 'hide', 'sanitize_callback' => 'munix_sanitize_select', ) ); $munix_section_choice_option = munix_section_choice_option(); $wp_customize->add_control( 'munix_contact_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Footer Callout', 'munix'), 'description' => esc_html__('Show/hide option for Footer Callout Section.', 'munix'), 'section' => 'munix_footer_contact', 'choices' => $munix_section_choice_option, 'priority' => 5 ) ); $wp_customize->add_setting( 'munix_ctah_heading', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'munix_ctah_heading', array( 'label' => esc_html__('Callout Text', 'munix'), 'section' => 'munix_footer_contact', 'priority' => 8 ) ); $wp_customize->add_setting( 'munix_ctah_btn_url', array( 'default' =>'', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'munix_ctah_btn_url', array( 'label' => esc_html__('Button URL', 'munix'), 'section' => 'munix_footer_contact', 'priority' => 10 ) ); $wp_customize->add_setting( 'munix_ctah_btn_text', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'munix_ctah_btn_text', array( 'label' => esc_html__('Button Text', 'munix'), 'section' => 'munix_footer_contact', 'priority' => 12 ) ); /** Callout Section Settings End **/ /** Footer Section Settings Start **/ $wp_customize->add_section('munix_footer_info', array( 'title' => esc_html__('Footer Section', 'munix'), 'description' => '', 'panel' => 'frontpage', 'priority' => 180 ) ); $wp_customize->add_setting('munix_footer_section_hideshow', array( 'default' => 'show', 'sanitize_callback' => 'munix_sanitize_select', ) ); $munix_footer_section_hide_show_option = munix_section_choice_option(); $wp_customize->add_control('munix_footer_section_hideshow', array( 'type' => 'radio', 'label' => esc_html__('Footer Option', 'munix'), 'description' => esc_html__('Show/hide option for Footer Section.', 'munix'), 'section' => 'munix_footer_info', 'choices' => $munix_footer_section_hide_show_option, 'priority' => 1 ) ); $wp_customize->add_setting('munix_footer_text', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'wp_kses_post' ) ); $wp_customize->add_control('munix_footer_text', array( 'label' => esc_html__('Copyright', 'munix'), 'section' => 'munix_footer_info', 'type' => 'textarea', 'priority' => 2 )); /** Footer Section Settings End **/ } add_action( 'customize_register', 'munix_customize_register' );