twentyfourteen_customize_register

Implement Customizer additions and adjustments.

Description

twentyfourteen_customize_register( (WP_Customize_Manager) $wp_customize ); 

Parameters (1)

0. $wp_customize (WP_Customize_Manager)
Customizer object.

Usage

  1. if ( !function_exists( 'twentyfourteen_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 = twentyfourteen_customize_register($wp_customize); 
  9.  

Defined (1)

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

/inc/customizer.php  
  1. function twentyfourteen_customize_register( $wp_customize ) { 
  2. // Add postMessage support for site title and description. 
  3. $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; 
  4. $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; 
  5. $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; 
  6.  
  7. if ( isset( $wp_customize->selective_refresh ) ) { 
  8. $wp_customize->selective_refresh->add_partial( 'blogname', array( 
  9. 'selector' => '.site-title a',  
  10. 'container_inclusive' => false,  
  11. 'render_callback' => 'twentyfourteen_customize_partial_blogname',  
  12. ) ); 
  13. $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 
  14. 'selector' => '.site-description',  
  15. 'container_inclusive' => false,  
  16. ) ); 
  17.  
  18. // Rename the label to "Site Title Color" because this only affects the site title in this theme. 
  19. $wp_customize->get_control( 'header_textcolor' )->label = __( 'Site Title Color', 'twentyfourteen' ); 
  20.  
  21. // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear. 
  22. $wp_customize->get_control( 'display_header_text' )->label = __( 'Display Site Title & Tagline', 'twentyfourteen' ); 
  23.  
  24. // Add custom description to Colors and Background controls or sections. 
  25. if ( property_exists( $wp_customize->get_control( 'background_color' ), 'description' ) ) { 
  26. $wp_customize->get_control( 'background_color' )->description = __( 'May only be visible on wide screens.', 'twentyfourteen' ); 
  27. $wp_customize->get_control( 'background_image' )->description = __( 'May only be visible on wide screens.', 'twentyfourteen' ); 
  28. } else { 
  29. $wp_customize->get_section( 'colors' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' ); 
  30. $wp_customize->get_section( 'background_image' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' ); 
  31.  
  32. // Add the featured content section in case it's not already there. 
  33. $wp_customize->add_section( featured_content, array( 
  34. 'title' => __( 'Featured Content', 'twentyfourteen' ),  
  35. 'description' => sprintf( __( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ),  
  36. esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ),  
  37. admin_url( 'edit.php?show_sticky=1' ) 
  38. ),  
  39. 'priority' => 130,  
  40. 'active_callback' => 'is_front_page',  
  41. ) ); 
  42.  
  43. // Add the featured content layout setting and control. 
  44. $wp_customize->add_setting( 'featured_content_layout', array( 
  45. 'default' => 'grid',  
  46. 'sanitize_callback' => 'twentyfourteen_sanitize_layout',  
  47. ) ); 
  48.  
  49. $wp_customize->add_control( 'featured_content_layout', array( 
  50. 'label' => __( 'Layout', 'twentyfourteen' ),  
  51. 'section' => featured_content,  
  52. 'type' => 'select',  
  53. 'choices' => array( 
  54. 'grid' => __( 'Grid', 'twentyfourteen' ),  
  55. 'slider' => __( 'Slider', 'twentyfourteen' ),  
  56. ),  
  57. ) );