• 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_header_style() – Styles the header image and text displayed on the blog.

You appear to be a bot. Output may be restricted

Description

Styles the header image and text displayed on the blog.

Usage

twentyfifteen_header_style();

Parameters

Returns

void

Source

File name: twentyfifteen/inc/custom-header.php
Lines:

1 to 100 of 108
  function twentyfifteen_header_style() {
    $header_image = get_header_image();

    // If no custom options for text are set, let's bail.
    if ( empty( $header_image ) && display_header_text() ) {
      return;
    }

    // If we get this far, we have custom styles. Let's do this.
    ?>
		<style type="text/css" id="twentyfifteen-header-css">
		<?php
    // Short header for when there is no Custom Header and Header Text is hidden.
    if ( empty( $header_image ) && ! display_header_text() ) :
      ?>
		.site-header {
			padding-top: 14px;
			padding-bottom: 14px;
		}

		.site-branding {
			min-height: 42px;
		}

		@media screen and (min-width: 46.25em) {
			.site-header {
				padding-top: 21px;
				padding-bottom: 21px;
			}
			.site-branding {
				min-height: 56px;
			}
		}
		@media screen and (min-width: 55em) {
			.site-header {
				padding-top: 25px;
				padding-bottom: 25px;
			}
			.site-branding {
				min-height: 62px;
			}
		}
		@media screen and (min-width: 59.6875em) {
			.site-header {
				padding-top: 0;
				padding-bottom: 0;
			}
			.site-branding {
				min-height: 0;
			}
		}
			<?php
    endif;

    // Has a Custom Header been added?
    if ( ! empty( $header_image ) ) :
      ?>
		.site-header {

			/*
			 * No shorthand so the Customizer can override individual properties.
			 * @see https://core.trac.wordpress.org/ticket/31460
			 */
			background-image: url(<?php header_image(); ?>);
			background-repeat: no-repeat;
			background-position: 50% 50%;
			-webkit-background-size: cover;
			-moz-background-size:    cover;
			-o-background-size:      cover;
			background-size:         cover;
		}

		@media screen and (min-width: 59.6875em) {
			body:before {

				/*
				 * No shorthand so the Customizer can override individual properties.
				 * @see https://core.trac.wordpress.org/ticket/31460
				 */
				background-image: url(<?php header_image(); ?>);
				background-repeat: no-repeat;
				background-position: 100% 50%;
				-webkit-background-size: cover;
				-moz-background-size:    cover;
				-o-background-size:      cover;
				background-size:         cover;
				border-right: 0;
			}

			.site-header {
				background: transparent;
			}
		}
			<?php
    endif;

    // Has the text been hidden?
    if ( ! display_header_text() ) :
      ?>
		.site-title,
 
[1] [2] Next »

 View on Trac

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

Primary Sidebar

Information

Function name: twentyfifteen_header_style
Plugin ref: Twenty Fifteen
Version: 3.3
Sourcefile: inc/custom-header.php
File ref: inc/custom-header.php
Deprecated?: No
API Letters: H,S,T

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.28
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-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites