selective_refresh ) ? 'postMessage' : 'refresh'; /*========================================= Header Settings Panel =========================================*/ $wp_customize->add_panel( 'header_section', array( 'priority' => 2, 'capability' => 'edit_theme_options', 'title' => __('Header', 'ac-repair-services'), ) ); /*========================================= AC Repair Services Site Identity =========================================*/ $wp_customize->add_section( 'title_tagline', array( 'priority' => 1, 'title' => __('Site Identity','ac-repair-services'), 'panel' => 'header_section', ) ); // topheader Logo Width $wp_customize->add_setting('topheader_logowidth',array( 'default' => 100, 'sanitize_callback' => 'acrepairservices_sanitize_float' )); $wp_customize->add_control(new acrepairservices_Custom_Control( $wp_customize, 'topheader_logowidth',array( 'label' => __('Logo Width','ac-repair-services'), 'section' => 'title_tagline', 'input_attrs' => array( 'min' => 0, 'max' => 500, 'step' => 1, ), ))); // top header Site Title Color $topheadersitetitlecol = esc_html__('#fff', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_sitetitlecol', array( 'default' => $topheadersitetitlecol, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 3, ) ); $wp_customize->add_control( 'topheader_sitetitlecol', array( 'label' => __('Site Title Color','ac-repair-services'), 'section' => 'title_tagline', 'type' => 'color', 'transport' => $selective_refresh, ) ); // top header Site Title brd Color $topheadersitetitlebrdcol = esc_html__('#fff', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_sitetitlebrdcol', array( 'default' => $topheadersitetitlebrdcol, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 3, ) ); $wp_customize->add_control( 'topheader_sitetitlebrdcol', array( 'label' => __('Site Title Border Color','ac-repair-services'), 'section' => 'title_tagline', 'type' => 'color', 'transport' => $selective_refresh, ) ); // top header Tagline Color $topheadertaglinecol = esc_html__('#000', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_taglinecol', array( 'default' => $topheadertaglinecol, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 4, ) ); $wp_customize->add_control( 'topheader_taglinecol', array( 'label' => __('Tagline Color','ac-repair-services'), 'section' => 'title_tagline', 'type' => 'color', 'transport' => $selective_refresh, ) ); /*========================================= AC Repair Services header =========================================*/ $wp_customize->add_section( 'top_header', array( 'priority' => 5, 'title' => __('Header','ac-repair-services'), 'panel' => 'header_section', ) ); $wp_customize->add_setting('acrepairservices_reset_header_settings',array( 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control(new acrepairservices_Reset_Custom_Control($wp_customize, 'acrepairservices_reset_header_settings',array( 'type' => 'reset_control', 'priority' => 1, 'label' => __('Reset Header Settings', 'ac-repair-services'), 'description' => 'acrepairservices_header_reset_settings', 'section' => 'top_header' ))); $wp_customize->add_setting('acrepairservices_top_header_tabs', array( 'sanitize_callback' => 'wp_kses_post', )); $wp_customize->add_control(new acrepairservices_Tab_Control($wp_customize, 'acrepairservices_top_header_tabs', array( 'section' => 'top_header', 'priority' => 1, 'buttons' => array( array( 'name' => esc_html__('General', 'ac-repair-services'), 'icon' => 'dashicons dashicons-welcome-write-blog', 'fields' => array( 'hide_show_sticky', 'topheader_emailicon', 'topheader_emailtext', 'topheader_addicon', 'topheader_addtext', 'topheader_contacticon', 'topheader_contactnumber' ), 'active' => true, ), array( 'name' => esc_html__('Style', 'ac-repair-services'), 'icon' => 'dashicons dashicons-art', 'fields' => array( 'topheader_leftboxbgcol1', 'topheader_leftboxbgcol2', 'topheader_iconcol1', 'topheader_iconcol2', 'topheader_colortext', 'topheader_colorborder', 'contact_iconcolor', 'contact_iconbgcolor1', 'contact_iconbgcolor2', 'contact_textcolor', 'contact_textbgcolor1', 'contact_textbgcolor2', 'header_bg_color', 'header_menu_color', 'header_menuarrow_color', 'header_menu_hover_color', 'header_submenubg_color1', 'header_submenubg_color2', 'header_submenutext_col', 'header_submenutext_hovercol', 'header_mobiletogglecol' ), ), array( 'name' => esc_html__('Layout', 'ac-repair-services'), 'icon' => 'dashicons dashicons-layout', 'fields' => array( 'acrepairservices_header_section_width' ), ) ), ))); // general setting // sticky header $wp_customize->add_setting( 'hide_show_sticky',array( 'default' => false, 'sanitize_callback' => 'acrepairservices_switch_sanitization' ) ); $wp_customize->add_control( new acrepairservices_Toggle_Switch_Custom_Control( $wp_customize, 'hide_show_sticky',array( 'label' => __( 'Show Sticky Header','ac-repair-services' ), 'section' => 'top_header' ))); // topheader icon 1 $topheaderemailicon = esc_html__('fas fa-envelope', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_emailicon', array( 'default' => $topheaderemailicon, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 5, ) ); $wp_customize->add_control( 'topheader_emailicon', array( 'label' => __('Email Icon','ac-repair-services'), 'section' => 'top_header', 'type' => 'text', 'transport' => $selective_refresh, ) ); // topheader text 1 $topheaderemailtext = esc_html__('info@gmail.com', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_emailtext', array( 'default' => $topheaderemailtext, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 6, ) ); $wp_customize->add_control( 'topheader_emailtext', array( 'label' => __('Email Text','ac-repair-services'), 'section' => 'top_header', 'type' => 'text', 'transport' => $selective_refresh, ) ); $topheadercontacticon = esc_html__('fa-solid fa-phone', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_contacticon', array( 'default' => $topheadercontacticon, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 7, ) ); $wp_customize->add_control( 'topheader_contacticon', array( 'label' => __('Phone Icon','ac-repair-services'), 'section' => 'top_header', 'type' => 'text', 'transport' => $selective_refresh, ) ); $topheadercontactnumber = esc_html__('+91 800 6359 734', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_contactnumber', array( 'default' => $topheadercontactnumber, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 7, ) ); $wp_customize->add_control( 'topheader_contactnumber', array( 'label' => __('Phone Number','ac-repair-services'), 'section' => 'top_header', 'type' => 'text', 'transport' => $selective_refresh, ) ); // style setting // top header left box color $topheaderleftboxbgcol1 = esc_html__('#6174be', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_leftboxbgcol1', array( 'default' => $topheaderleftboxbgcol1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 18, ) ); $wp_customize->add_control( 'topheader_leftboxbgcol1', array( 'label' => __('Left Box BG Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // top header left box color $topheaderleftboxbgcol2 = esc_html__('#28a0a8', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_leftboxbgcol2', array( 'default' => $topheaderleftboxbgcol2, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 18, ) ); $wp_customize->add_control( 'topheader_leftboxbgcol2', array( 'label' => __('Left Box BG Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // top header icon 1 $topheadericoncol1 = esc_html__('#7390e0', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_iconcol1', array( 'default' => $topheadericoncol1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 19, ) ); $wp_customize->add_control( 'topheader_iconcol1', array( 'label' => __('Email Icon Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // top header icon 2 $topheadericoncol2 = esc_html__('#57cbd3', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_iconcol2', array( 'default' => $topheadericoncol2, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 19, ) ); $wp_customize->add_control( 'topheader_iconcol2', array( 'label' => __('Email Icon Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // top header text $topheadercolortext = esc_html__('#262626', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_colortext', array( 'default' => $topheadercolortext, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 21, ) ); $wp_customize->add_control( 'topheader_colortext', array( 'label' => __('Email Text Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // top header border color $topheadercolorborder = esc_html__('#c0c0c0', 'ac-repair-services' ); $wp_customize->add_setting( 'topheader_colorborder', array( 'default' => $topheadercolorborder, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 21, ) ); $wp_customize->add_control( 'topheader_colorborder', array( 'label' => __('Top Border Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // contact icon color $contacticoncolor = esc_html__('#fff', 'ac-repair-services' ); $wp_customize->add_setting( 'contact_iconcolor', array( 'default' => $contacticoncolor, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'contact_iconcolor', array( 'label' => __('Social Icon Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // contact icon color $contacticoncolor = esc_html__('#fff', 'ac-repair-services' ); $wp_customize->add_setting( 'contact_iconcolor', array( 'default' => $contacticoncolor, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'contact_iconcolor', array( 'label' => __('Phone Icon Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // contact icon color 1 $contacticonbgcolor1 = esc_html__('#6174be', 'ac-repair-services' ); $wp_customize->add_setting( 'contact_iconbgcolor1', array( 'default' => $contacticonbgcolor1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'contact_iconbgcolor1', array( 'label' => __('Phone Icon BG Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // contact icon color 2 $contacticonbgcolor2 = esc_html__('#28a0a8', 'ac-repair-services' ); $wp_customize->add_setting( 'contact_iconbgcolor2', array( 'default' => $contacticonbgcolor2, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'contact_iconbgcolor2', array( 'label' => __('Phone Icon BG Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // contact text color $contacttextcolor = esc_html__('#fff', 'ac-repair-services' ); $wp_customize->add_setting( 'contact_textcolor', array( 'default' => $contacttextcolor, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'contact_textcolor', array( 'label' => __('Phone Text Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // contact text color 1 $contacttextbgcolor1 = esc_html__('#6174be', 'ac-repair-services' ); $wp_customize->add_setting( 'contact_textbgcolor1', array( 'default' => $contacttextbgcolor1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'contact_textbgcolor1', array( 'label' => __('Phone Text BG Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // contact text color 2 $contacttextbgcolor2 = esc_html__('#28a0a8', 'ac-repair-services' ); $wp_customize->add_setting( 'contact_textbgcolor2', array( 'default' => $contacttextbgcolor2, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'contact_textbgcolor2', array( 'label' => __('Phone Text BG Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // bg color $header_bg_color = esc_html__('#fff', 'ac-repair-services' ); $wp_customize->add_setting( 'header_bg_color', array( 'default' => $header_bg_color, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'header_bg_color', array( 'label' => __('BG Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // menu color $header_menu_color = esc_html__('#000', 'ac-repair-services' ); $wp_customize->add_setting( 'header_menu_color', array( 'default' => $header_menu_color, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'header_menu_color', array( 'label' => __('Menus Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // menuarrow color $header_menuarrow_color = esc_html__('#000', 'ac-repair-services' ); $wp_customize->add_setting( 'header_menuarrow_color', array( 'default' => $header_menuarrow_color, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'header_menuarrow_color', array( 'label' => __('Menus Arrow Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // menu hover color $header_menu_hover_color = esc_html__('#28a0a8', 'ac-repair-services' ); $wp_customize->add_setting( 'header_menu_hover_color', array( 'default' => $header_menu_hover_color, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'header_menu_hover_color', array( 'label' => __('Menus Hover Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // sub bg color1 $header_submenubg_color1 = esc_html__('#6174be', 'ac-repair-services' ); $wp_customize->add_setting( 'header_submenubg_color1', array( 'default' => $header_submenubg_color1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'header_submenubg_color1', array( 'label' => __('Sub Menu BG Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // sub bg color2 $header_submenubg_color2 = esc_html__('#28a0a8', 'ac-repair-services' ); $wp_customize->add_setting( 'header_submenubg_color2', array( 'default' => $header_submenubg_color2, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'header_submenubg_color2', array( 'label' => __('Sub Menu BG Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // sub text color2 $header_submenutext_col = esc_html__('#fff', 'ac-repair-services' ); $wp_customize->add_setting( 'header_submenutext_col', array( 'default' => $header_submenutext_col, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'header_submenutext_col', array( 'label' => __('Sub Menu Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // sub text color hover 2 $header_submenutext_hovercol = esc_html__('#000', 'ac-repair-services' ); $wp_customize->add_setting( 'header_submenutext_hovercol', array( 'default' => $header_submenutext_hovercol, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'header_submenutext_hovercol', array( 'label' => __('Sub Menu Hover Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // mobile menu toggle color $header_mobiletogglecol = esc_html__('#000', 'ac-repair-services' ); $wp_customize->add_setting( 'header_mobiletogglecol', array( 'default' => $header_mobiletogglecol, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_kses_post', 'priority' => 22, ) ); $wp_customize->add_control( 'header_mobiletogglecol', array( 'label' => __('Mobile View Toggle Color','ac-repair-services'), 'section' => 'top_header', 'type' => 'color', 'transport' => $selective_refresh, ) ); // layout setting $wp_customize->add_setting('acrepairservices_header_section_width',array( 'default' => 'Box Width', 'sanitize_callback' => 'acrepairservices_sanitize_choices', )); $wp_customize->add_control('acrepairservices_header_section_width',array( 'type' => 'select', 'label' => __('Header Width','ac-repair-services'), 'choices' => array ( 'Box Width' => __('Box Width','ac-repair-services'), 'Full Width' => __('Full Width','ac-repair-services') ), 'section' => 'top_header', )); $wp_customize->register_control_type('acrepairservices_Tab_Control'); $wp_customize->register_panel_type( 'acrepairservices_WP_Customize_Panel' ); $wp_customize->register_section_type( 'acrepairservices_WP_Customize_Section' ); } add_action( 'customize_register', 'acrepairservices_header_settings' ); if ( class_exists( 'WP_Customize_Panel' ) ) { class acrepairservices_WP_Customize_Panel extends WP_Customize_Panel { public $panel; public $type = 'acrepairservices_panel'; public function json() { $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'type', 'panel', ) ); $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); $array['content'] = $this->get_content(); $array['active'] = $this->active(); $array['instanceNumber'] = $this->instance_number; return $array; } } } if ( class_exists( 'WP_Customize_Section' ) ) { class acrepairservices_WP_Customize_Section extends WP_Customize_Section { public $section; public $type = 'acrepairservices_section'; public function json() { $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'panel', 'type', 'description_hidden', 'section', ) ); $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); $array['content'] = $this->get_content(); $array['active'] = $this->active(); $array['instanceNumber'] = $this->instance_number; if ( $this->panel ) { $array['customizeAction'] = sprintf( 'Customizing ▸ %s', esc_html( $this->manager->get_panel( $this->panel )->title ) ); } else { $array['customizeAction'] = 'Customizing'; } return $array; } } }