twentyfifteen_header_background_color_css

Enqueues front-end CSS for the header background color.

Description

twentyfifteen_header_background_color_css(); 

Usage

  1. if ( !function_exists( 'twentyfifteen_header_background_color_css' ) ) { 
  2. require_once '/inc/custom-header.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = twentyfifteen_header_background_color_css(); 
  7.  

Defined (1)

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

/inc/custom-header.php  
  1. function twentyfifteen_header_background_color_css() { 
  2. $color_scheme = twentyfifteen_get_color_scheme(); 
  3. $default_color = $color_scheme[1]; 
  4. $header_background_color = get_theme_mod( 'header_background_color', $default_color ); 
  5.  
  6. // Don't do anything if the current color is the default. 
  7. if ( $header_background_color === $default_color ) { 
  8. return; 
  9.  
  10. $css = ' 
  11. /* Custom Header Background Color */ 
  12. body:before,  
  13. .site-header { 
  14. background-color: %1$s; 
  15.  
  16. @media screen and (min-width: 59.6875em) { 
  17. .site-header,  
  18. .secondary { 
  19. background-color: transparent; 
  20.  
  21. .widget button,  
  22. .widget input[type="button"],  
  23. .widget input[type="reset"],  
  24. .widget input[type="submit"],  
  25. .widget_calendar tbody a,  
  26. .widget_calendar tbody a:hover,  
  27. .widget_calendar tbody a:focus { 
  28. color: %1$s; 
  29. '; 
  30.  
  31. wp_add_inline_style( 'twentyfifteen-style', sprintf( $css, $header_background_color ) );