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' => 'askella_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'askella_customize_partial_blogdescription', ) ); } /////////////////////////////////////////// /////////////////////////////////////////// /////////////////////////////////////////// /////////////////////////////////////////// ////////////////// // COLORS ////////////////// // PANEL // --default-bg-color $wp_customize->add_setting('--panel-color-h', array( 'default' => 5, 'transport' => 'refresh', )); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, '--default-bg-color', array( 'label' => __('Panel Background Color', 'starter'), 'description' => __('Set the color of the Panel (Main Content Area)'), 'mode' => 'hue', 'section' => 'colors', 'settings' => '--panel-color-h', ))); $wp_customize->add_setting('--panel-color-l', array( 'default' => 99, )); $wp_customize->add_control('--panel-color-l', array( 'label' => __('Panel Background Lightness'), 'type' => 'range', 'description' => __('Set the lightness of the Panel (Main Content Area)'), 'input_attrs' => array( 'min' => 0, 'max' => 100, 'step' => 1, ), 'section' => 'colors', )); // MENU // --menu-bg-color $wp_customize->add_setting('--menu-color-h', array( 'default' => 200, 'transport' => 'refresh', )); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, '--menu-color-h', array( 'label' => __('Menu Background Color', 'starter'), 'description' => __('Set the color of the Menu'), 'mode' => 'hue', 'section' => 'colors', 'settings' => '--menu-color-h', ))); $wp_customize->add_setting('--menu-color-l', array( 'default' => 5, )); $wp_customize->add_control('--menu-color-l', array( 'label' => __('Menu Background Lightness'), 'type' => 'range', 'description' => __('Set the lightness of the Menu'), 'input_attrs' => array( 'min' => 0, 'max' => 100, 'step' => 1, ), 'section' => 'colors', )); //Brand Color $wp_customize->add_setting('--sidebar-brand-color', array( 'default' => '#eeeeee', )); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, '--sidebar-brand-color', array( 'label' => __('Sidebar Brand Color', 'starter'), 'description' => __('Set the color of Brand Text'), 'section' => 'colors', 'settings' => '--sidebar-brand-color', ))); //Brand Color $wp_customize->add_setting('--sidebar-brand-color', array( 'default' => '#eeeeee', )); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, '--sidebar-brand-color', array( 'label' => __('Sidebar Brand Color', 'starter'), 'description' => __('Set the color of Brand Text'), 'section' => 'colors', 'settings' => '--sidebar-brand-color', ))); //Link Color $wp_customize->add_setting('--link-color-angle', array( 'default' => 214, )); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, '--link-color-angle', array( 'label' => __('Link Color', 'starter'), 'description' => __('Set the color of Links'), 'mode' => 'hue', 'section' => 'colors', 'settings' => '--link-color-angle', ))); ////////////////// //LAYOUT ////////////////// $wp_customize->add_section('layout_section_name', array( 'title' => __('Layout', 'layout'), 'priority' => 40 )); // MENU WIDTH $wp_customize->add_setting('--menu-width', array( 'default' => 320, 'transport' => 'refresh', )); $wp_customize->add_control('--menu-width', array( 'label' => __('Menu Width'), 'description' => __('Set the sidebar-menu width in pixels'), 'type' => 'number', 'section' => 'layout_section_name', )); //MENU ALWAYS VISIBLE $wp_customize->add_setting('--open-menu-on-lg', array( 'default' => 'left', 'transport' => 'refresh', )); $wp_customize->add_control('--open-menu-on-lg', array( 'label' => __('--open-menu-on-lg'), 'description' => __('Set the sidebar-menu width in pixels'), 'type' => 'radio', 'section' => 'layout_section_name', 'choices' => array( true => 'Open menu on large screens', false => 'Keep menu closed', ), )); /////////////////////////////////////////// /////////////////////////////////////////// /////////////////////////////////////////// /////////////////////////////////////////// } add_action( 'customize_register', 'askella_customize_register' ); /** * Render the site title for the selective refresh partial. * * @return void */ function askella_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function askella_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function askella_customize_preview_js() { wp_enqueue_script( 'askella-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), _S_VERSION, true ); } add_action( 'customize_preview_init', 'askella_customize_preview_js' );