get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->get_section('colors')->title = __( 'Askella Colors', 'askella' ); 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 ////////////////// //MENU $wp_customize->add_setting('--menu-bg-color', array( 'default' => '#1f1f1f', 'sanitize_callback' => 'esc_attr', )); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, '--menu-bg-color', array( 'label' => __('Sidebar Background Color', 'askella'), 'description' => __('Set the Sidebar Background Color', 'askella'), 'section' => 'colors', 'settings' => '--menu-bg-color', ))); // PANEL $wp_customize->add_setting('--default-bg-color', array( 'default' => '#f5f5f5', 'sanitize_callback' => 'esc_attr', )); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, '--default-bg-color', array( 'label' => __('Content Area Background Color', 'askella'), 'description' => __('Set the Content Area Background Color', 'askella'), 'section' => 'colors', 'settings' => '--default-bg-color', ))); // LINK COLOR $wp_customize->add_setting('--link-color', array( 'default' => '#4169e1', 'sanitize_callback' => 'esc_attr', )); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, '--link-color', array( 'label' => __('Link Color', 'askella'), 'description' => __('Set the Link Color', 'askella'), 'section' => 'colors', 'settings' => '--link-color', ))); ////////////////// //LAYOUT ////////////////// $wp_customize->add_section('layout_section_name', array( 'title' => __('Askella Layout', 'askella'), 'priority' => 40 )); // MENU WIDTH $wp_customize->add_setting('--menu-width', array( 'default' => 320, 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr', )); $wp_customize->add_control('--menu-width', array( 'label' => __('Menu Width', 'askella'), 'description' => __('Set the primary menu width in pixels (default: 320)', 'askella'), 'type' => 'number', 'section' => 'layout_section_name', )); //MENU ALWAYS VISIBLE $wp_customize->add_setting('--open-menu-on-lg', array( 'default' => false, 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr', )); $wp_customize->add_control('--open-menu-on-lg', array( 'label' => __('Open Menu on large Screens', 'askella'), 'description' => __('Control whether the menu should be open on large screens', 'askella'), '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' );