Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentythirteen/inc/custom-header.php

    r36709 r42343  
    4343     * %s is a placeholder for the theme template directory URI.
    4444     */
    45     register_default_headers( array(
    46         'circle' => array(
    47             'url'           => '%s/images/headers/circle.png',
    48             'thumbnail_url' => '%s/images/headers/circle-thumbnail.png',
    49             'description'   => _x( 'Circle', 'header image description', 'twentythirteen' )
    50         ),
    51         'diamond' => array(
    52             'url'           => '%s/images/headers/diamond.png',
    53             'thumbnail_url' => '%s/images/headers/diamond-thumbnail.png',
    54             'description'   => _x( 'Diamond', 'header image description', 'twentythirteen' )
    55         ),
    56         'star' => array(
    57             'url'           => '%s/images/headers/star.png',
    58             'thumbnail_url' => '%s/images/headers/star-thumbnail.png',
    59             'description'   => _x( 'Star', 'header image description', 'twentythirteen' )
    60         ),
    61     ) );
     45    register_default_headers(
     46        array(
     47            'circle'  => array(
     48                'url'           => '%s/images/headers/circle.png',
     49                'thumbnail_url' => '%s/images/headers/circle-thumbnail.png',
     50                'description'   => _x( 'Circle', 'header image description', 'twentythirteen' ),
     51            ),
     52            'diamond' => array(
     53                'url'           => '%s/images/headers/diamond.png',
     54                'thumbnail_url' => '%s/images/headers/diamond-thumbnail.png',
     55                'description'   => _x( 'Diamond', 'header image description', 'twentythirteen' ),
     56            ),
     57            'star'    => array(
     58                'url'           => '%s/images/headers/star.png',
     59                'thumbnail_url' => '%s/images/headers/star-thumbnail.png',
     60                'description'   => _x( 'Star', 'header image description', 'twentythirteen' ),
     61            ),
     62        )
     63    );
    6264}
    6365add_action( 'after_setup_theme', 'twentythirteen_custom_header_setup', 11 );
     
    8991
    9092    // If no custom options for text are set, let's bail.
    91     if ( empty( $header_image ) && $text_color == get_theme_support( 'custom-header', 'default-text-color' ) )
     93    if ( empty( $header_image ) && $text_color == get_theme_support( 'custom-header', 'default-text-color' ) ) {
    9294        return;
     95    }
    9396
    9497    // If we get this far, we have custom styles.
     
    9699    <style type="text/css" id="twentythirteen-header-css">
    97100    <?php
    98         if ( ! empty( $header_image ) ) :
    99     ?>
     101    if ( ! empty( $header_image ) ) :
     102    ?>
     103    .site-header {
     104        background: url(<?php header_image(); ?>) no-repeat scroll top;
     105        background-size: 1600px auto;
     106    }
     107    @media (max-width: 767px) {
    100108        .site-header {
    101             background: url(<?php header_image(); ?>) no-repeat scroll top;
    102             background-size: 1600px auto;
    103         }
    104         @media (max-width: 767px) {
    105             .site-header {
    106                 background-size: 768px auto;
    107             }
    108         }
    109         @media (max-width: 359px) {
    110             .site-header {
    111                 background-size: 360px auto;
    112             }
    113         }
     109            background-size: 768px auto;
     110        }
     111    }
     112    @media (max-width: 359px) {
     113        .site-header {
     114            background-size: 360px auto;
     115        }
     116    }
    114117    <?php
    115118        endif;
    116119
    117120        // Has the text been hidden?
    118         if ( ! display_header_text() ) :
    119     ?>
    120         .site-title,
    121         .site-description {
    122             position: absolute;
    123             clip: rect(1px 1px 1px 1px); /* IE7 */
    124             clip: rect(1px, 1px, 1px, 1px);
    125         }
    126     <?php
    127             if ( empty( $header_image ) ) :
    128     ?>
    129         .site-header .home-link {
    130             min-height: 0;
    131         }
    132     <?php
    133             endif;
     121    if ( ! display_header_text() ) :
     122    ?>
     123    .site-title,
     124    .site-description {
     125        position: absolute;
     126        clip: rect(1px 1px 1px 1px); /* IE7 */
     127        clip: rect(1px, 1px, 1px, 1px);
     128    }
     129    <?php
     130    if ( empty( $header_image ) ) :
     131    ?>
     132    .site-header .home-link {
     133    min-height: 0;
     134    }
     135    <?php
     136        endif;
    134137
    135138        // If the user has set a custom color for the text, use that.
     
    162165        if ( ! empty( $header_image ) ) {
    163166            echo 'background: url(' . esc_url( $header_image ) . ') no-repeat scroll top; background-size: 1600px auto;';
    164         } ?>
     167        }
     168        ?>
    165169        padding: 0 20px;
    166170    }
     
    174178        if ( ! empty( $header_image ) || display_header_text() ) {
    175179            echo 'min-height: 230px;';
    176         } ?>
     180        }
     181        ?>
    177182        width: 100%;
    178183    }
     
    228233        </div>
    229234    </div>
    230 <?php }
     235<?php
     236}
Note: See TracChangeset for help on using the changeset viewer.