get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'architectwp_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'architectwp_customize_partial_blogdescription', ) ); } $wp_customize->add_setting( 'link_color' , array( 'default' => '#e74c3c', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize,'link_color', array( 'label' => esc_html__( 'Link Color', 'architectwp' ), 'section' => 'colors', 'settings' => 'link_color', ) ) ); //Header Section (text & link) $wp_customize->add_setting( 'header_main_text', array( 'default' => '', // Optional. 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize,'header_main_text', array( 'label' => esc_html__( 'Header Main Text', 'architectwp' ), 'section' => 'header_image', 'type' => 'textarea', ) ) ); //header sub text $wp_customize->add_setting( 'header_sub_text', array( 'default' => '', // Optional. 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize,'header_sub_text', array( 'label' => esc_html__( 'Header Sub Text', 'architectwp' ), 'section' => 'header_image', 'type' => 'text', ) ) ); //header button label $wp_customize->add_setting( 'header_button_label', array( 'default' => esc_html__('View More','architectwp'), 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize,'header_button_label', array( 'label' => esc_html__( 'Button Label', 'architectwp' ), 'section' => 'header_image', 'type' => 'text', ) ) ); //header button url $wp_customize->add_setting( 'header_button_url', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize,'header_button_url', array( 'label' => esc_html__( 'Button URL(required for button to show)', 'architectwp' ), 'section' => 'header_image', 'type' => 'url', ) ) ); //Add Home Intro Section /** * Add home intro section */ $wp_customize->add_section( 'intro_section', array( 'title' => esc_html__( 'Home Intro Section', 'architectwp' ), 'description' => esc_html__( 'Add an intro section to the homepage', 'architectwp' ), 'priority' => 50, ) ); $wp_customize->add_setting( 'intro_toggle', array( 'default' => 'disable', 'sanitize_callback' => 'architectwp_sanitize_radio', ) ); $wp_customize->add_control( 'intro_toggle', array( 'label' => esc_html__( 'Enable/Disable Section', 'architectwp' ), 'section' => 'intro_section', 'priority' => 1, // Optional. Order priority to load the control. Default: 10 'type' => 'radio', 'capability' => 'edit_theme_options', // Optional. Default: 'edit_theme_options' 'choices' => array( // Optional. 'enable' => esc_html__( 'Enable','architectwp' ), 'disable' => esc_html__( 'Disable' ,'architectwp') ) ) ); //About Section title $wp_customize->add_setting( 'intro_title', array( 'default' => '', 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize,'intro_title', array( 'label' => esc_html__( 'Section Title', 'architectwp' ), 'section' => 'intro_section', 'type' => 'text', ) ) ); //About Section Sub Title $wp_customize->add_setting( 'intro_sub_title', array( 'default' => '', 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize,'intro_sub_title', array( 'label' => esc_html__( 'Section Title', 'architectwp' ), 'section' => 'intro_section', 'type' => 'textarea', ) ) ); //About Section Sub Title $wp_customize->add_setting( 'intro_content', array( 'default' => '', 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize,'intro_content', array( 'label' => esc_html__( 'Section Content', 'architectwp' ), 'section' => 'intro_section', 'type' => 'textarea', ) ) ); //radio box sanitization function function architectwp_sanitize_radio( $input, $setting ){ //input must be a slug: lowercase alphanumeric characters, dashes and underscores are allowed only $input = sanitize_key($input); //get the list of possible radio box options $choices = $setting->manager->get_control( $setting->id )->choices; //return input if valid or return default option return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } //Add pro upsell in customizer $wp_customize->add_section( 'architectwpstyle_view_pro', array( 'title' => esc_html__( 'Upgrage to Pro', 'architectwp' ), 'priority' => 1, 'description' => sprintf( /* translators: upsell mesage */ __( '
Get the pro add-on plugin today: