WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (4 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/twentyten/header.php

    r42228 r42343  
    1313<head>
    1414<meta charset="<?php bloginfo( 'charset' ); ?>" />
    15 <title><?php
     15<title>
     16<?php
    1617    /*
    1718     * Print the <title> tag based on what is being viewed.
     
    2627    // Add the blog description for the home/front page.
    2728    $site_description = get_bloginfo( 'description', 'display' );
    28     if ( $site_description && ( is_home() || is_front_page() ) )
    29         echo " | $site_description";
     29if ( $site_description && ( is_home() || is_front_page() ) ) {
     30    echo " | $site_description";
     31}
    3032
    3133    // Add a page number if necessary:
    32     if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() )
    33         echo esc_html( ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) ) );
     34if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
     35    echo esc_html( ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) ) );
     36}
    3437
    35     ?></title>
     38    ?>
     39    </title>
    3640<link rel="profile" href="http://gmpg.org/xfn/11" />
    3741<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
     
    4246     * to support sites with threaded comments (when in use).
    4347     */
    44     if ( is_singular() && get_option( 'thread_comments' ) )
    45         wp_enqueue_script( 'comment-reply' );
     48if ( is_singular() && get_option( 'thread_comments' ) ) {
     49    wp_enqueue_script( 'comment-reply' );
     50}
    4651
    4752    /*
     
    7075                <?php
    7176                    // Compatibility with versions of WordPress prior to 3.4.
    72                     if ( function_exists( 'get_custom_header' ) ) {
    73                         /*
    74                         * We need to figure out what the minimum width should be for our featured image.
    75                         * This result would be the suggested width if the theme were to implement flexible widths.
    76                         */
    77                         $header_image_width = get_theme_support( 'custom-header', 'width' );
    78                     } else {
    79                         $header_image_width = HEADER_IMAGE_WIDTH;
    80                     }
     77                if ( function_exists( 'get_custom_header' ) ) {
     78                    /*
     79                    * We need to figure out what the minimum width should be for our featured image.
     80                    * This result would be the suggested width if the theme were to implement flexible widths.
     81                    */
     82                    $header_image_width = get_theme_support( 'custom-header', 'width' );
     83                } else {
     84                    $header_image_width = HEADER_IMAGE_WIDTH;
     85                }
    8186
    8287                    // Check if this is a post or page, if it has a thumbnail, and if it's a big one
    83                     if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
     88                if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
    8489                            has_post_thumbnail( $post->ID ) &&
    8590                            ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
    8691                            $image[1] >= $header_image_width ) :
    87                         // Houston, we have a new header image!
    88                         echo get_the_post_thumbnail( $post->ID );
     92                    // Houston, we have a new header image!
     93                    echo get_the_post_thumbnail( $post->ID );
    8994                    elseif ( get_header_image() ) :
    9095                        // Compatibility with versions of WordPress prior to 3.4.
     
    105110                <div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
    106111                <?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
    107                 <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
     112                <?php
     113                wp_nav_menu(
     114                    array(
     115                        'container_class' => 'menu-header',
     116                        'theme_location'  => 'primary',
     117                    )
     118                );
     119?>
    108120            </div><!-- #access -->
    109121        </div><!-- #masthead -->
Note: See TracChangeset for help on using the changeset viewer.