• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / twentyseventeen_customize_register() – Add postMessage support for site title and description for the Theme Customizer.

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' ),
[1] [2] Next »

 View on GitHub View on Trac

Published: 8th April 2020 | Last updated: 21st August 2020

Primary Sidebar

Information

Function name: twentyseventeen_customize_register
Plugin ref: Twenty Seventeen
Version: 2.5
Sourcefile: inc/customizer.php
File ref: inc/customizer.php
Deprecated?: No
API Letters: C,R,T

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 5.6.2. PHP: 7.3.27
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites