twentyfifteen_customize_register

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

Description

twentyfifteen_customize_register( (WP_Customize_Manager) $wp_customize ); 

Parameters (1)

0. $wp_customize (WP_Customize_Manager)
Customizer object.

Usage

  1. if ( !function_exists( 'twentyfifteen_customize_register' ) ) { 
  2. require_once '/inc/customizer.php'; 
  3.  
  4. // Customizer object. 
  5. $wp_customize = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = twentyfifteen_customize_register($wp_customize); 
  9.  

Defined (1)

The function is defined in the following location(s).

/inc/customizer.php  
  1. function twentyfifteen_customize_register( $wp_customize ) { 
  2. $color_scheme = twentyfifteen_get_color_scheme(); 
  3.  
  4. $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; 
  5. $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; 
  6.  
  7. // Add color scheme setting and control. 
  8. $wp_customize->add_setting( 'color_scheme', array( 
  9. 'default' => 'default',  
  10. 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme',  
  11. 'transport' => 'postMessage',  
  12. ) ); 
  13.  
  14. $wp_customize->add_control( 'color_scheme', array( 
  15. 'label' => __( 'Base Color Scheme', 'twentyfifteen' ),  
  16. 'section' => 'colors',  
  17. 'type' => 'select',  
  18. 'priority' => 1,  
  19. ) ); 
  20.  
  21. // Add custom header and sidebar text color setting and control. 
  22. $wp_customize->add_setting( 'sidebar_textcolor', array( 
  23. 'default' => $color_scheme[4],  
  24. 'sanitize_callback' => 'sanitize_hex_color',  
  25. 'transport' => 'postMessage',  
  26. ) ); 
  27.  
  28. $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sidebar_textcolor', array( 
  29. 'label' => __( 'Header and Sidebar Text Color', 'twentyfifteen' ),  
  30. 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ),  
  31. 'section' => 'colors',  
  32. ) ) ); 
  33.  
  34. // Remove the core header textcolor control, as it shares the sidebar text color. 
  35. $wp_customize->remove_control( 'header_textcolor' ); 
  36.  
  37. // Add custom header and sidebar background color setting and control. 
  38. $wp_customize->add_setting( 'header_background_color', array( 
  39. 'default' => $color_scheme[1],  
  40. 'sanitize_callback' => 'sanitize_hex_color',  
  41. 'transport' => 'postMessage',  
  42. ) ); 
  43.  
  44. $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_background_color', array( 
  45. 'label' => __( 'Header and Sidebar Background Color', 'twentyfifteen' ),  
  46. 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ),  
  47. 'section' => 'colors',  
  48. ) ) ); 
  49.  
  50. // Add an additional description to the header image section. 
  51. $wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' );