twentyfifteen_header_style

Styles the header image and text displayed on the blog.

Description

twentyfifteen_header_style(); 

Usage

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

Defined (1)

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

/inc/custom-header.php  
  1. function twentyfifteen_header_style() { 
  2. $header_image = get_header_image(); 
  3.  
  4. // If no custom options for text are set, let's bail. 
  5. if ( empty( $header_image ) && display_header_text() ) { 
  6. return; 
  7.  
  8. // If we get this far, we have custom styles. Let's do this. 
  9. ?> 
  10. <style type="text/css" id="twentyfifteen-header-css"> 
  11. <?php 
  12. // Short header for when there is no Custom Header and Header Text is hidden. 
  13. if ( empty( $header_image ) && ! display_header_text() ) : 
  14. ?> 
  15. .site-header { 
  16. padding-top: 14px; 
  17. padding-bottom: 14px; 
  18.  
  19. .site-branding { 
  20. min-height: 42px; 
  21.  
  22. @media screen and (min-width: 46.25em) { 
  23. .site-header { 
  24. padding-top: 21px; 
  25. padding-bottom: 21px; 
  26. .site-branding { 
  27. min-height: 56px; 
  28. @media screen and (min-width: 55em) { 
  29. .site-header { 
  30. padding-top: 25px; 
  31. padding-bottom: 25px; 
  32. .site-branding { 
  33. min-height: 62px; 
  34. @media screen and (min-width: 59.6875em) { 
  35. .site-header { 
  36. padding-top: 0; 
  37. padding-bottom: 0; 
  38. .site-branding { 
  39. min-height: 0; 
  40. <?php 
  41. endif; 
  42.  
  43. // Has a Custom Header been added? 
  44. if ( ! empty( $header_image ) ) : 
  45. ?> 
  46. .site-header { 
  47.  
  48. /* 
  49. * No shorthand so the Customizer can override individual properties. 
  50. * @see https://core.trac.wordpress.org/ticket/31460 
  51. */ 
  52. background-image: url(<?php header_image(); ?>); 
  53. background-repeat: no-repeat; 
  54. background-position: 50% 50%; 
  55. -webkit-background-size: cover; 
  56. -moz-background-size: cover; 
  57. -o-background-size: cover; 
  58. background-size: cover; 
  59.  
  60. @media screen and (min-width: 59.6875em) { 
  61. body:before { 
  62.  
  63. /* 
  64. * No shorthand so the Customizer can override individual properties. 
  65. * @see https://core.trac.wordpress.org/ticket/31460 
  66. */ 
  67. background-image: url(<?php header_image(); ?>); 
  68. background-repeat: no-repeat; 
  69. background-position: 100% 50%; 
  70. -webkit-background-size: cover; 
  71. -moz-background-size: cover; 
  72. -o-background-size: cover; 
  73. background-size: cover; 
  74. border-right: 0; 
  75.  
  76. .site-header { 
  77. background: transparent; 
  78. <?php 
  79. endif; 
  80.  
  81. // Has the text been hidden? 
  82. if ( ! display_header_text() ) : 
  83. ?> 
  84. .site-title,  
  85. .site-description { 
  86. clip: rect(1px, 1px, 1px, 1px); 
  87. position: absolute; 
  88. <?php endif; ?> 
  89. </style> 
  90. <?php