• 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 / twentyfifteen_customize_register() – Add postMessage support for site title and description for the Customizer.

You appear to be a bot. Output may be restricted

Description

Add postMessage support for site title and description for the Customizer.

Usage

twentyfifteen_customize_register( $wp_customize );

Parameters

$wp_customize
( WP_Customize_Manager ) required – Customizer object.

Returns

void

Source

File name: twentyfifteen/inc/customizer.php
Lines:

1 to 96 of 96
function twentyfifteen_customize_register( $wp_customize ) {
  $color_scheme = twentyfifteen_get_color_scheme();

  $wp_customize->get_setting( 'blogname' )->transport        = 'postMessage';
  $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';

  if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial(
      'blogname',
      array(
        'selector'            => '.site-title a',
        'container_inclusive' => false,
        'render_callback'     => 'twentyfifteen_customize_partial_blogname',
      )
    );
    $wp_customize->selective_refresh->add_partial(
      'blogdescription',
      array(
        'selector'            => '.site-description',
        'container_inclusive' => false,
        'render_callback'     => 'twentyfifteen_customize_partial_blogdescription',
      )
    );
  }

  // Add color scheme setting and control.
  $wp_customize->add_setting(
    'color_scheme',
    array(
      'default'           => 'default',
      'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme',
      'transport'         => 'postMessage',
    )
  );

  $wp_customize->add_control(
    'color_scheme',
    array(
      'label'    => __( 'Base Color Scheme', 'twentyfifteen' ),
      'section'  => 'colors',
      'type'     => 'select',
      'choices'  => twentyfifteen_get_color_scheme_choices(),
      'priority' => 1,
    )
  );

  // Add custom header and sidebar text color setting and control.
  $wp_customize->add_setting(
    'sidebar_textcolor',
    array(
      'default'           => $color_scheme[4],
      'sanitize_callback' => 'sanitize_hex_color',
      'transport'         => 'postMessage',
    )
  );

  $wp_customize->add_control(
    new WP_Customize_Color_Control(
      $wp_customize,
      'sidebar_textcolor',
      array(
        'label'       => __( 'Header and Sidebar Text Color', 'twentyfifteen' ),
        'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ),
        'section'     => 'colors',
      )
    )
  );

  // Remove the core header textcolor control, as it shares the sidebar text color.
  $wp_customize->remove_control( 'header_textcolor' );

  // Add custom header and sidebar background color setting and control.
  $wp_customize->add_setting(
    'header_background_color',
    array(
      'default'           => $color_scheme[1],
      'sanitize_callback' => 'sanitize_hex_color',
      'transport'         => 'postMessage',
    )
  );

  $wp_customize->add_control(
    new WP_Customize_Color_Control(
      $wp_customize,
      'header_background_color',
      array(
        'label'       => __( 'Header and Sidebar Background Color', 'twentyfifteen' ),
        'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ),
        'section'     => 'colors',
      )
    )
  );

  // Add an additional description to the header image section.
  $wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' );
}
 

 View on Trac

Published: 19th December 2019 | Last updated: 19th December 2019

Primary Sidebar

Information

Function name: twentyfifteen_customize_register
Plugin ref: Twenty Fifteen
Version: 2.8
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. PHP: 7.3.26
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