selective_refresh ) ? 'postMessage' : 'refresh';
/*=========================================
Header Settings Panel
=========================================*/
$wp_customize->add_panel(
'header_section',
array(
'priority' => 2,
'capability' => 'edit_theme_options',
'title' => __('Header', 'artech'),
)
);
/*=========================================
Artech Site Identity
=========================================*/
$wp_customize->add_section(
'title_tagline',
array(
'priority' => 1,
'title' => __('Site Identity','artech'),
'panel' => 'header_section',
)
);
//Project Documentation Link
class WP_title_tagline_Customize_Control extends WP_Customize_Control {
public $type = 'new_menu';
function render_content()
{
?>
How to use site identity section :
Header > site identity Section
Click Here
add_setting(
'title_tagline_doc_link' ,
array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(new WP_title_tagline_Customize_Control($wp_customize,
'title_tagline_doc_link' ,
array(
'label' => __( 'Site identity Documentation Link', 'artech' ),
'section' => 'title_tagline',
'type' => 'radio',
'description' => __( 'Site identity Documentation Link', 'artech' ),
)
) );
// Logo Width //
if ( class_exists( 'Artech_Customizer_Range_Control' ) ) {
$wp_customize->add_setting(
'logo_width',
array(
'default' => '140',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_range_value',
'transport' => 'postMessage',
)
);
$wp_customize->add_control(
new Artech_Customizer_Range_Control( $wp_customize, 'logo_width',
array(
'label' => __( 'Logo Width', 'artech' ),
'section' => 'title_tagline',
'media_query' => true,
'input_attr' => array(
'mobile' => array(
'min' => 0,
'max' => 500,
'step' => 1,
'default_value' => 140,
),
'tablet' => array(
'min' => 0,
'max' => 500,
'step' => 1,
'default_value' => 140,
),
'desktop' => array(
'min' => 0,
'max' => 500,
'step' => 1,
'default_value' => 140,
),
),
) )
);
}
// Typography
$wp_customize->add_setting(
'logo_typography'
,array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_text',
)
);
$wp_customize->add_control(
'logo_typography',
array(
'type' => 'hidden',
'label' => __('Typography','artech'),
'section' => 'title_tagline',
'priority' => 100,
)
);
// Site Title Font Size//
if ( class_exists( 'Artech_Customizer_Range_Control' ) ) {
$wp_customize->add_setting(
'site_ttl_size',
array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_range_value',
'transport' => 'postMessage'
)
);
$wp_customize->add_control(
new Artech_Customizer_Range_Control( $wp_customize, 'site_ttl_size',
array(
'label' => __( 'Site Title Font Size', 'artech' ),
'section' => 'title_tagline',
'priority' => 101,
'media_query' => true,
'input_attr' => array(
'mobile' => array(
'min' => 0,
'max' => 100,
'step' => 1,
'default_value' => 30,
),
'tablet' => array(
'min' => 0,
'max' => 100,
'step' => 1,
'default_value' => 30,
),
'desktop' => array(
'min' => 0,
'max' => 100,
'step' => 1,
'default_value' => 30,
),
),
) )
);
// Site Description Font Size//
$wp_customize->add_setting(
'site_desc_size',
array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_range_value',
'transport' => 'postMessage'
)
);
$wp_customize->add_control(
new Artech_Customizer_Range_Control( $wp_customize, 'site_desc_size',
array(
'label' => __( 'Site Description Font Size', 'artech' ),
'section' => 'title_tagline',
'priority' => 102,
'media_query' => true,
'input_attr' => array(
'mobile' => array(
'min' => 0,
'max' => 100,
'step' => 1,
'default_value' => 12,
),
'tablet' => array(
'min' => 0,
'max' => 100,
'step' => 1,
'default_value' => 12,
),
'desktop' => array(
'min' => 0,
'max' => 100,
'step' => 1,
'default_value' => 12,
),
),
) )
);
}
/*=========================================
Above Header Section
=========================================*/
$wp_customize->add_section(
'above_header',
array(
'priority' => 2,
'title' => __('Above Header','artech'),
'panel' => 'header_section',
)
);
/*=========================================
Email
=========================================*/
$wp_customize->add_setting(
'hdr_top_email'
,array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_text',
'priority' => 16,
)
);
$wp_customize->add_control(
'hdr_top_email',
array(
'type' => 'hidden',
'label' => __('Email','artech'),
'section' => 'above_header',
)
);
$wp_customize->add_setting(
'hide_show_email_details' ,
array(
'default' => '1',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_checkbox',
'priority' => 17,
)
);
$wp_customize->add_control(
'hide_show_email_details',
array(
'label' => esc_html__( 'Hide/Show', 'artech' ),
'section' => 'above_header',
'type' => 'checkbox'
)
);
// icon //
$wp_customize->add_setting(
'tlh_email_icon',
array(
'default' => 'fa-envelope',
'sanitize_callback' => 'sanitize_text_field',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(new Artech_Icon_Picker_Control($wp_customize,
'tlh_email_icon',
array(
'label' => __('Icon','artech'),
'section' => 'above_header',
'iconset' => 'fa',
))
);
// Email title //
$wp_customize->add_setting(
'tlh_email_title',
array(
'default' => __('Write Us','artech'),
'sanitize_callback' => 'artech_sanitize_text',
'capability' => 'edit_theme_options',
'priority' => 18,
)
);
$wp_customize->add_control(
'tlh_email_title',
array(
'label' => __('Email Title','artech'),
'section' => 'above_header',
'type' => 'text'
)
);
// Mobile Number //
$wp_customize->add_setting(
'tlh_email',
array(
'default' => __('email@example.com','artech'),
'sanitize_callback' => 'artech_sanitize_text',
'capability' => 'edit_theme_options',
'priority' => 18,
)
);
$wp_customize->add_control(
'tlh_email',
array(
'label' => __('Email Address','artech'),
'section' => 'above_header',
'type' => 'text'
)
);
/*=========================================
Address
=========================================*/
$wp_customize->add_setting(
'hdr_top_address'
,array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_text',
'priority' => 16,
)
);
$wp_customize->add_control(
'hdr_top_address',
array(
'type' => 'hidden',
'label' => __('Address','artech'),
'section' => 'above_header',
)
);
$wp_customize->add_setting(
'hide_show_cntct_details' ,
array(
'default' => '1',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_checkbox',
'priority' => 17,
)
);
$wp_customize->add_control(
'hide_show_cntct_details',
array(
'label' => esc_html__( 'Hide/Show', 'artech' ),
'section' => 'above_header',
'type' => 'checkbox'
)
);
// icon //
$wp_customize->add_setting(
'tlh_contct_icon',
array(
'default' => 'fa-map-marker-alt',
'sanitize_callback' => 'sanitize_text_field',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(new Artech_Icon_Picker_Control($wp_customize,
'tlh_contct_icon',
array(
'label' => __('Icon','artech'),
'section' => 'above_header',
'iconset' => 'fa',
))
);
// Address //
$wp_customize->add_setting(
'tlh_contact_address',
array(
'default' => __('25 N Grant Street, Laxington','artech'),
'sanitize_callback' => 'artech_sanitize_text',
'capability' => 'edit_theme_options',
'priority' => 18,
)
);
$wp_customize->add_control(
'tlh_contact_address',
array(
'label' => __('Email Address','artech'),
'section' => 'above_header',
'type' => 'text'
)
);
// Button Label //
$wp_customize->add_setting(
'tlh_btn_lbl',
array(
'default' => __('Buy Now','artech'),
'sanitize_callback' => 'artech_sanitize_text',
'capability' => 'edit_theme_options',
'priority' => 5,
)
);
$wp_customize->add_control(
'tlh_btn_lbl',
array(
'label' => __('Button Label','artech'),
'section' => 'above_header',
'type' => 'text'
)
);
// Button Link //
$wp_customize->add_setting(
'tlh_btn_link',
array(
'default' => '#',
'sanitize_callback' => 'artech_sanitize_text',
'capability' => 'edit_theme_options',
'priority' => 5,
)
);
$wp_customize->add_control(
'tlh_btn_link',
array(
'label' => __('Button Link','artech'),
'section' => 'above_header',
'type' => 'text'
)
);
$wp_customize->add_setting(
'hdr_social_icon'
,array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_text',
'priority' => 16,
)
);
$wp_customize->add_control(
'hdr_social_icon',
array(
'type' => 'hidden',
'label' => __('Social Icon','artech'),
'section' => 'above_header',
)
);
$wp_customize->add_setting(
'hide_show_social_icon' ,
array(
'default' => '1',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_checkbox',
'priority' => 17,
)
);
$wp_customize->add_control(
'hide_show_social_icon',
array(
'label' => esc_html__( 'Hide/Show', 'artech' ),
'section' => 'above_header',
'type' => 'checkbox'
)
);
/**
* Customizer Repeater
*/
$wp_customize->add_setting( 'social_icons',
array(
'sanitize_callback' => 'artech_repeater_sanitize',
'priority' => 18,
'default' => artech_get_social_icon_default()
)
);
$wp_customize->add_control(
new Artech_Repeater( $wp_customize,
'social_icons',
array(
'label' => esc_html__('Icons','artech'),
'section' => 'above_header',
'customizer_repeater_icon_control' => true,
'customizer_repeater_link_control' => true,
)
)
);
//Pro feature
class Artech_social_icons__section_upgrade extends WP_Customize_Control {
public function render_content() {
?>
add_setting( 'Artech_social_icons_upgrade_to_pro', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'wp_filter_nohtml_kses',
'priority' => 5,
));
$wp_customize->add_control(
new Artech_social_icons__section_upgrade(
$wp_customize,
'Artech_social_icons_upgrade_to_pro',
array(
'section' => 'above_header',
'settings' => 'Artech_social_icons_upgrade_to_pro',
)
)
);
/*=========================================
Header Navigation
=========================================*/
$wp_customize->add_section(
'header_navigation',
array(
'priority' => 4,
'title' => __('Header Navigation','artech'),
'panel' => 'header_section',
)
);
// Search
$wp_customize->add_setting(
'hdr_nav_search'
,array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_text',
'priority' => 1,
)
);
$wp_customize->add_control(
'hdr_nav_search',
array(
'type' => 'hidden',
'label' => __('Search','artech'),
'section' => 'header_navigation',
)
);
$wp_customize->add_setting(
'hide_show_search' ,
array(
'default' => '1',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_checkbox',
'priority' => 2,
)
);
$wp_customize->add_control(
'hide_show_search',
array(
'label' => esc_html__( 'Hide/Show', 'artech' ),
'section' => 'header_navigation',
'type' => 'checkbox'
)
);
// Cart
$wp_customize->add_setting(
'hdr_nav_cart'
,array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_pro_sanitize_text',
'priority' => 3,
)
);
$wp_customize->add_control(
'hdr_nav_cart',
array(
'type' => 'hidden',
'label' => __('Cart','artech'),
'section' => 'header_navigation',
)
);
$wp_customize->add_setting(
'hide_show_cart' ,
array(
'default' => '1',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_pro_sanitize_checkbox',
'priority' => 4,
)
);
$wp_customize->add_control(
'hide_show_cart',
array(
'label' => esc_html__( 'Hide/Show', 'artech' ),
'section' => 'header_navigation',
'type' => 'checkbox'
)
);
/*=========================================
Sticky Header
=========================================*/
$wp_customize->add_section(
'sticky_header_set',
array(
'priority' => 4,
'title' => __('Sticky Header','artech'),
'panel' => 'header_section',
)
);
// Heading
$wp_customize->add_setting(
'sticky_head'
,array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_text',
'priority' => 1,
)
);
$wp_customize->add_control(
'sticky_head',
array(
'type' => 'hidden',
'label' => __('Sticky Header','artech'),
'section' => 'sticky_header_set',
)
);
$wp_customize->add_setting(
'hide_show_sticky' ,
array(
'default' => '1',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'artech_sanitize_checkbox',
'priority' => 2,
)
);
$wp_customize->add_control(
'hide_show_sticky',
array(
'label' => esc_html__( 'Hide/Show', 'artech' ),
'section' => 'sticky_header_set',
'type' => 'checkbox'
)
);
}
add_action( 'customize_register', 'artech_header_settings' );
// Header selective refresh
function artech_header_partials( $wp_customize ){
// hide_show_nav_btn
$wp_customize->selective_refresh->add_partial(
'hide_show_nav_btn', array(
'selector' => '.navigator .av-button-area',
'container_inclusive' => true,
'render_callback' => 'header_navigation',
'fallback_refresh' => true,
)
);
// tlh_email_icon
$wp_customize->selective_refresh->add_partial( 'tlh_email_icon', array(
'selector' => '.author-popup .widget-contact .content-area .contact-icon i',
'settings' => 'tlh_email_icon',
'render_callback' => 'artech_tlh_email_icon_render_callback',
) );
// tlh_email
$wp_customize->selective_refresh->add_partial( 'tlh_email', array(
'selector' => '.author-popup .widget-contact .content-area .contact-info a span',
'settings' => 'tlh_email',
'render_callback' => 'artech_tlh_email_render_callback',
) );
// tlh_contct_icon
$wp_customize->selective_refresh->add_partial( 'tlh_contct_icon', array(
'selector' => '.author-popup .widget-contact .content-area .contact-icon i',
'settings' => 'tlh_contct_icon',
'render_callback' => 'artech_tlh_contct_icon_render_callback',
) );
// tlh_contact_address
$wp_customize->selective_refresh->add_partial( 'tlh_contact_address', array(
'selector' => '.author-popup .widget-contact .content-area .contact-info a span',
'settings' => 'tlh_contact_address',
'render_callback' => 'artech_tlh_contact_address_render_callback',
) );
// tlh_button_icon
$wp_customize->selective_refresh->add_partial( 'tlh_button_icon', array(
'selector' => '.header-button .main-button i, .header-button-2 .main-button-3 p i',
'settings' => 'tlh_button_icon',
'render_callback' => 'artech_tlh_button_icon_render_callback',
) );
// nav_btn_lbl
$wp_customize->selective_refresh->add_partial( 'nav_btn_lbl', array(
'selector' => '.header-button .main-button span, .header-button-2 .main-button-3 p',
'settings' => 'nav_btn_lbl',
'render_callback' => 'artech_nav_btn_lbl_render_callback',
) );
// nav_btn_link
$wp_customize->selective_refresh->add_partial( 'nav_btn_link', array(
'selector' => '.header-button .main-button, .header-button-2 .main-button-3',
'settings' => 'nav_btn_link',
'render_callback' => 'artech_nav_btn_link_render_callback',
) );
}
add_action( 'customize_register', 'artech_header_partials' );
// tlh_mobile_icon
function artech_tlh_mobile_icon_render_callback() {
return get_theme_mod( 'tlh_mobile_icon' );
}
// tlh_mobile_title
function artech_tlh_mobile_title_render_callback() {
return get_theme_mod( 'tlh_mobile_title' );
}
// tlh_mobile_number
function artech_tlh_mobile_number_render_callback() {
return get_theme_mod( 'tlh_mobile_number' );
}
// tlh_email_icon
function artech_tlh_email_icon_render_callback() {
return get_theme_mod( 'tlh_email_icon' );
}
// tlh_email
function artech_tlh_email_render_callback() {
return get_theme_mod( 'tlh_email' );
}
// tlh_contct_icon
function artech_tlh_tlh_contct_icon_render_callback() {
return get_theme_mod( 'tlh_contct_icon' );
}
// tlh_contact_address
function artech_tlh_contact_address_render_callback() {
return get_theme_mod( 'tlh_contact_address' );
}
// nav_btn_lbl
function artech_nav_btn_lbl_render_callback() {
return get_theme_mod( 'nav_btn_lbl' );
}
// nav_btn_link
function artech_nav_btn_link_render_callback() {
return get_theme_mod( 'nav_btn_link' );
}
// hdr_nav_text_content
function artech_hdr_nav_text_content_render_callback() {
return get_theme_mod( 'hdr_nav_text_content' );
}
// hdr_nav_contact_content
function artech_hdr_nav_contact_content_render_callback() {
return get_theme_mod( 'hdr_nav_contact_content' );
}
// hdr_nav_contact_content2
function artech_hdr_nav_contact_content2_render_callback() {
return get_theme_mod( 'hdr_nav_contact_content2' );
}
// hdr_nav_contact_content3
function artech_hdr_nav_contact_content3_render_callback() {
return get_theme_mod( 'hdr_nav_contact_content3' );
}