get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->add_setting('awal_widget_header_color', array( 'default' => '#2d53fe', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh', )); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'awal_widget_header_color', array( 'label' => __('Widget Header Color', 'awal'), 'section' => 'colors', ))); $wp_customize->add_setting('awal_link_color', array( 'default' => '#2d53fe', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh', )); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'awal_link_color', array( 'label' => __('Link Color', 'awal'), 'section' => 'colors', ))); $wp_customize->add_section( 'awal_header_section' , array( 'title' => __( 'Header', 'awal' ), 'priority' => 30 )); $wp_customize->add_setting( 'awal_header_facebook' , array( 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh', )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'awal_header_facebook', array( 'label' => __( 'Facebook Link', 'awal' ), 'section' => 'awal_header_section', 'settings' => 'awal_header_facebook', 'type' => 'text' ))); $wp_customize->add_setting( 'awal_header_twitter' , array( 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'awal_header_twitter', array( 'label' => __( 'Twitter Link', 'awal' ), 'section' => 'awal_header_section', 'settings' => 'awal_header_twitter', 'type' => 'text' ))); $wp_customize->add_setting( 'awal_header_linked' , array( 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'awal_header_linked', array( 'label' => __( 'Linkedin Link', 'awal' ), 'section' => 'awal_header_section', 'settings' => 'awal_header_linked', 'type' => 'text' ))); $wp_customize->add_setting( 'awal_header_instagram' , array( 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'awal_header_instagram', array( 'label' => __( 'Instagram Link', 'awal' ), 'section' => 'awal_header_section', 'settings' => 'awal_header_instagram', 'type' => 'text' ))); $wp_customize->add_setting( 'awal_header_youtube' , array( 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'awal_header_youtube', array( 'label' => __( 'Youtube Link', 'awal' ), 'section' => 'awal_header_section', 'settings' => 'awal_header_youtube', 'type' => 'text' ))); if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'awal_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'awal_customize_partial_blogdescription', ) ); } } add_action( 'customize_register', 'awal_customize_register' ); // Change and reflect value accordingly function awal_change_link_color() { $header_color = get_theme_mod('awal_link_color', '#2d53fe'); $widget_header_color = get_theme_mod('awal_widget_header_color', '#2d53fe'); $background_color = get_background_color(); print ' '; } add_action('wp_head', 'awal_change_link_color', 1100); /** * Render the site title for the selective refresh partial. * * @return void */ function awal_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function awal_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function awal_customize_preview_js() { wp_enqueue_script( 'awal-customizer', get_template_directory_uri() . '/assets/js/customizer.js', array( 'customize-preview' ), AWAL_VERSION, true ); } add_action( 'customize_preview_init', 'awal_customize_preview_js' );