Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (6 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/twentysixteen/image.php

    r40851 r42343  
    1515            <?php
    1616                // Start the loop.
    17                 while ( have_posts() ) : the_post();
     17            while ( have_posts() ) :
     18                the_post();
    1819            ?>
    1920
    20                 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     21            <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    2122
    22                     <nav id="image-navigation" class="navigation image-navigation">
    23                         <div class="nav-links">
    24                             <div class="nav-previous"><?php previous_image_link( false, __( 'Previous Image', 'twentysixteen' ) ); ?></div>
    25                             <div class="nav-next"><?php next_image_link( false, __( 'Next Image', 'twentysixteen' ) ); ?></div>
    26                         </div><!-- .nav-links -->
    27                     </nav><!-- .image-navigation -->
     23                <nav id="image-navigation" class="navigation image-navigation">
     24                    <div class="nav-links">
     25                        <div class="nav-previous"><?php previous_image_link( false, __( 'Previous Image', 'twentysixteen' ) ); ?></div>
     26                        <div class="nav-next"><?php next_image_link( false, __( 'Next Image', 'twentysixteen' ) ); ?></div>
     27                    </div><!-- .nav-links -->
     28                </nav><!-- .image-navigation -->
    2829
    29                     <header class="entry-header">
    30                         <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
    31                     </header><!-- .entry-header -->
     30                <header class="entry-header">
     31                    <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
     32                </header><!-- .entry-header -->
    3233
    33                     <div class="entry-content">
     34                <div class="entry-content">
    3435
    35                         <div class="entry-attachment">
    36                             <?php
    37                                 /**
    38                                 * Filter the default twentysixteen image attachment size.
    39                                 *
    40                                 * @since Twenty Sixteen 1.0
    41                                 *
    42                                 * @param string $image_size Image size. Default 'large'.
    43                                 */
    44                                 $image_size = apply_filters( 'twentysixteen_attachment_size', 'large' );
     36                    <div class="entry-attachment">
     37                        <?php
     38                            /**
     39                            * Filter the default twentysixteen image attachment size.
     40                            *
     41                            * @since Twenty Sixteen 1.0
     42                            *
     43                            * @param string $image_size Image size. Default 'large'.
     44                            */
     45                            $image_size = apply_filters( 'twentysixteen_attachment_size', 'large' );
    4546
    46                                 echo wp_get_attachment_image( get_the_ID(), $image_size );
    47                             ?>
     47                            echo wp_get_attachment_image( get_the_ID(), $image_size );
     48                        ?>
    4849
    49                             <?php twentysixteen_excerpt( 'entry-caption' ); ?>
     50                        <?php twentysixteen_excerpt( 'entry-caption' ); ?>
    5051
    5152                        </div><!-- .entry-attachment -->
    5253
    5354                        <?php
    54                             the_content();
    55                             wp_link_pages( array(
     55                        the_content();
     56                        wp_link_pages(
     57                            array(
    5658                                'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentysixteen' ) . '</span>',
    5759                                'after'       => '</div>',
     
    6062                                'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>%',
    6163                                'separator'   => '<span class="screen-reader-text">, </span>',
    62                             ) );
    63                         ?>
     64                            )
     65                        );
     66                    ?>
    6467                    </div><!-- .entry-content -->
    6568
    6669                    <footer class="entry-footer">
    67                         <?php twentysixteen_entry_meta(); ?>
     70                    <?php twentysixteen_entry_meta(); ?>
    6871                        <?php
    69                             // Retrieve attachment metadata.
    70                             $metadata = wp_get_attachment_metadata();
    71                             if ( $metadata ) {
    72                                 printf( '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s &times; %4$s</a></span>',
    73                                     esc_html_x( 'Full size', 'Used before full size attachment link.', 'twentysixteen' ),
    74                                     esc_url( wp_get_attachment_url() ),
    75                                     absint( $metadata['width'] ),
    76                                     absint( $metadata['height'] )
    77                                 );
    78                             }
     72                        // Retrieve attachment metadata.
     73                        $metadata = wp_get_attachment_metadata();
     74                        if ( $metadata ) {
     75                            printf(
     76                                '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s &times; %4$s</a></span>',
     77                                esc_html_x( 'Full size', 'Used before full size attachment link.', 'twentysixteen' ),
     78                                esc_url( wp_get_attachment_url() ),
     79                                absint( $metadata['width'] ),
     80                                absint( $metadata['height'] )
     81                            );
     82                        }
    7983                        ?>
    8084                        <?php
    81                             edit_post_link(
    82                                 sprintf(
    83                                     /* translators: %s: Name of current post */
    84                                     __( 'Edit<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ),
    85                                     get_the_title()
    86                                 ),
    87                                 '<span class="edit-link">',
    88                                 '</span>'
    89                             );
    90                         ?>
     85                        edit_post_link(
     86                            sprintf(
     87                                /* translators: %s: Name of current post */
     88                                __( 'Edit<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ),
     89                                get_the_title()
     90                            ),
     91                            '<span class="edit-link">',
     92                            '</span>'
     93                        );
     94                    ?>
    9195                    </footer><!-- .entry-footer -->
    9296                </article><!-- #post-## -->
    9397
    9498                <?php
    95                     // If comments are open or we have at least one comment, load up the comment template.
    96                     if ( comments_open() || get_comments_number() ) {
    97                         comments_template();
    98                     }
     99                // If comments are open or we have at least one comment, load up the comment template.
     100                if ( comments_open() || get_comments_number() ) {
     101                    comments_template();
     102                }
    99103
    100                     // Parent post navigation.
    101                     the_post_navigation( array(
     104                // Parent post navigation.
     105                the_post_navigation(
     106                    array(
    102107                        'prev_text' => _x( '<span class="meta-nav">Published in</span><span class="post-title">%title</span>', 'Parent post link', 'twentysixteen' ),
    103                     ) );
     108                    )
     109                );
    104110                // End the loop.
    105111                endwhile;
Note: See TracChangeset for help on using the changeset viewer.