You appear to be a bot. Output may be restricted
Description
Add postMessage support for site title and description for the Theme Customizer.
Usage
twentyseventeen_customize_register( $wp_customize );
Parameters
- $wp_customize
- ( WP_Customize_Manager ) required – Theme Customizer object.
Returns
void
Source
File name: twentyseventeen/inc/customizer.php
Lines:
1 to 100 of 150
function twentyseventeen_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'twentyseventeen_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'twentyseventeen_customize_partial_blogdescription', ) ); /** * Custom colors. */ $wp_customize->add_setting( 'colorscheme', array( 'default' => 'light', 'transport' => 'postMessage', 'sanitize_callback' => 'twentyseventeen_sanitize_colorscheme', ) ); $wp_customize->add_setting( 'colorscheme_hue', array( 'default' => 250, 'transport' => 'postMessage', 'sanitize_callback' => 'absint', // The hue is stored as a positive integer. ) ); $wp_customize->add_control( 'colorscheme', array( 'type' => 'radio', 'label' => __( 'Color Scheme', 'twentyseventeen' ), 'choices' => array( 'light' => __( 'Light', 'twentyseventeen' ), 'dark' => __( 'Dark', 'twentyseventeen' ), 'custom' => __( 'Custom', 'twentyseventeen' ), ), 'section' => 'colors', 'priority' => 5, ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'colorscheme_hue', array( 'mode' => 'hue', 'section' => 'colors', 'priority' => 6, ) ) ); /** * Theme options. */ $wp_customize->add_section( 'theme_options', array( 'title' => __( 'Theme Options', 'twentyseventeen' ), 'priority' => 130, // Before Additional CSS. ) ); $wp_customize->add_setting( 'page_layout', array( 'default' => 'two-column', 'sanitize_callback' => 'twentyseventeen_sanitize_page_layout', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'page_layout', array( 'label' => __( 'Page Layout', 'twentyseventeen' ), 'section' => 'theme_options', 'type' => 'radio', 'description' => __( 'When the two-column layout is assigned, the page title is in one column and content is in the other.', 'twentyseventeen' ), 'choices' => array( 'one-column' => __( 'One Column', 'twentyseventeen' ), 'two-column' => __( 'Two Column', 'twentyseventeen' ),