Make WordPress Core

Ticket #39152: 39152.diff

File 39152.diff, 35.4 KB (added by sstoqnov, 10 years ago)

Fix php errors and warnings in twentyseventeen

  • src/wp-content/themes/twentyseventeen/comments.php

     
    3030        if ( have_comments() ) : ?>
    3131                <h2 class="comments-title">
    3232                        <?php
    33                                 $comments_number = get_comments_number();
    34                                 if ( '1' === $comments_number ) {
    35                                         /* translators: %s: post title */
    36                                         printf( _x( 'One Reply to &ldquo;%s&rdquo;', 'comments title', 'twentyseventeen' ), get_the_title() );
    37                                 } else {
    38                                         printf(
    39                                                 /* translators: 1: number of comments, 2: post title */
    40                                                 _nx(
    41                                                         '%1$s Reply to &ldquo;%2$s&rdquo;',
    42                                                         '%1$s Replies to &ldquo;%2$s&rdquo;',
    43                                                         $comments_number,
    44                                                         'comments title',
    45                                                         'twentyseventeen'
    46                                                 ),
    47                                                 number_format_i18n( $comments_number ),
    48                                                 get_the_title()
    49                                         );
    50                                 }
     33                        $comments_number = get_comments_number();
     34                        if ( '1' === $comments_number ) {
     35                                /* translators: %s: post title */
     36                                printf( _x( 'One Reply to &ldquo;%s&rdquo;', 'comments title', 'twentyseventeen' ), get_the_title() );
     37                        } else {
     38                                printf(
     39                                        /* translators: 1: number of comments, 2: post title */
     40                                        _nx(
     41                                                '%1$s Reply to &ldquo;%2$s&rdquo;',
     42                                                '%1$s Replies to &ldquo;%2$s&rdquo;',
     43                                                $comments_number,
     44                                                'comments title',
     45                                                'twentyseventeen'
     46                                        ),
     47                                        number_format_i18n( $comments_number ),
     48                                        get_the_title()
     49                                );
     50                        }
    5151                        ?>
    5252                </h2>
    5353
  • src/wp-content/themes/twentyseventeen/functions.php

     
    310310 *
    311311 * @since Twenty Seventeen 1.0
    312312 *
     313 * @param string  $link Link to single post/page
    313314 * @return string 'Continue reading' link prepended with an ellipsis.
    314315 */
    315316function twentyseventeen_excerpt_more( $link ) {
  • src/wp-content/themes/twentyseventeen/inc/color-patterns.php

     
    9595.colors-custom .site-footer .widget-area a,
    9696.colors-custom .posts-navigation a,
    9797.colors-custom .widget_authors a strong {
    98         -webkit-box-shadow: inset 0 -1px 0 hsl( ' . $hue . ', ' . $saturation  . ', 6% ); /* base: rgba(15, 15, 15, 1); */
     98        -webkit-box-shadow: inset 0 -1px 0 hsl( ' . $hue . ', ' . $saturation . ', 6% ); /* base: rgba(15, 15, 15, 1); */
    9999        box-shadow: inset 0 -1px 0 hsl( ' . $hue . ', ' . $saturation . ', 6% ); /* base: rgba(15, 15, 15, 1); */
    100100}
    101101
     
    201201.colors-custom .widget ul li a:focus,
    202202.colors-custom .widget ul li a:hover {
    203203        -webkit-box-shadow: inset 0 0 0 hsl( ' . $hue . ', ' . $saturation . ', 13% ), 0 3px 0 hsl( ' . $hue . ', ' . $saturation . ', 13% );
    204         box-shadow: inset 0 0 0 hsl( ' . $hue . ', ' . $saturation. ' , 13% ), 0 3px 0 hsl( ' . $hue . ', ' . $saturation . ', 13% );
     204        box-shadow: inset 0 0 0 hsl( ' . $hue . ', ' . $saturation . ' , 13% ), 0 3px 0 hsl( ' . $hue . ', ' . $saturation . ', 13% );
    205205}
    206206
    207207body.colors-custom,
     
    560560        }
    561561}';
    562562
    563 
    564563        /**
    565564         * Filters Twenty Seventeen custom colors CSS.
    566565         *
  • src/wp-content/themes/twentyseventeen/inc/custom-header.php

     
    5353add_action( 'after_setup_theme', 'twentyseventeen_custom_header_setup' );
    5454
    5555if ( ! function_exists( 'twentyseventeen_header_style' ) ) :
    56 /**
    57  * Styles the header image and text displayed on the blog.
    58  *
    59  * @see twentyseventeen_custom_header_setup().
    60  */
    61 function twentyseventeen_header_style() {
    62         $header_text_color = get_header_textcolor();
     56        /**
     57        * Styles the header image and text displayed on the blog.
     58        *
     59        * @see twentyseventeen_custom_header_setup().
     60        */
     61        function twentyseventeen_header_style() {
     62                $header_text_color = get_header_textcolor();
    6363
    64         // If no custom options for text are set, let's bail.
    65         // get_header_textcolor() options: add_theme_support( 'custom-header' ) is default, hide text (returns 'blank') or any hex value.
    66         if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) {
    67                 return;
     64                // If no custom options for text are set, let's bail.
     65                // get_header_textcolor() options: add_theme_support( 'custom-header' ) is default, hide text (returns 'blank') or any hex value.
     66                if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) {
     67                        return;
     68                }
     69
     70                // If we get this far, we have custom styles. Let's do this.
     71                ?>
     72                <style id="twentyseventeen-custom-header-styles" type="text/css">
     73                <?php
     74                        // Has the text been hidden?
     75                        if ( 'blank' === $header_text_color ) :
     76                ?>
     77                        .site-title,
     78                        .site-description {
     79                                position: absolute;
     80                                clip: rect(1px, 1px, 1px, 1px);
     81                        }
     82                <?php
     83                        // If the user has set a custom color for the text use that.
     84                        else :
     85                ?>
     86                        .site-title a,
     87                        .colors-dark .site-title a,
     88                        .colors-custom .site-title a,
     89                        body.has-header-image .site-title a,
     90                        body.has-header-video .site-title a,
     91                        body.has-header-image.colors-dark .site-title a,
     92                        body.has-header-video.colors-dark .site-title a,
     93                        body.has-header-image.colors-custom .site-title a,
     94                        body.has-header-video.colors-custom .site-title a,
     95                        .site-description,
     96                        .colors-dark .site-description,
     97                        .colors-custom .site-description,
     98                        body.has-header-image .site-description,
     99                        body.has-header-video .site-description,
     100                        body.has-header-image.colors-dark .site-description,
     101                        body.has-header-video.colors-dark .site-description,
     102                        body.has-header-image.colors-custom .site-description,
     103                        body.has-header-video.colors-custom .site-description {
     104                                color: #<?php echo esc_attr( $header_text_color ); ?>;
     105                        }
     106                <?php endif; ?>
     107                </style>
     108                <?php
    68109        }
    69 
    70         // If we get this far, we have custom styles. Let's do this.
    71         ?>
    72         <style id="twentyseventeen-custom-header-styles" type="text/css">
    73         <?php
    74                 // Has the text been hidden?
    75                 if ( 'blank' === $header_text_color ) :
    76         ?>
    77                 .site-title,
    78                 .site-description {
    79                         position: absolute;
    80                         clip: rect(1px, 1px, 1px, 1px);
    81                 }
    82         <?php
    83                 // If the user has set a custom color for the text use that.
    84                 else :
    85         ?>
    86                 .site-title a,
    87                 .colors-dark .site-title a,
    88                 .colors-custom .site-title a,
    89                 body.has-header-image .site-title a,
    90                 body.has-header-video .site-title a,
    91                 body.has-header-image.colors-dark .site-title a,
    92                 body.has-header-video.colors-dark .site-title a,
    93                 body.has-header-image.colors-custom .site-title a,
    94                 body.has-header-video.colors-custom .site-title a,
    95                 .site-description,
    96                 .colors-dark .site-description,
    97                 .colors-custom .site-description,
    98                 body.has-header-image .site-description,
    99                 body.has-header-video .site-description,
    100                 body.has-header-image.colors-dark .site-description,
    101                 body.has-header-video.colors-dark .site-description,
    102                 body.has-header-image.colors-custom .site-description,
    103                 body.has-header-video.colors-custom .site-description {
    104                         color: #<?php echo esc_attr( $header_text_color ); ?>;
    105                 }
    106         <?php endif; ?>
    107         </style>
    108         <?php
    109 }
    110110endif; // End of twentyseventeen_header_style.
    111111
    112112/**
    113113 * Customize video play/pause button in the custom header.
     114 *
     115 * @param array  $settings Video settings
    114116 */
    115117function twentyseventeen_video_controls( $settings ) {
    116118        $settings['l10n']['play'] = '<span class="screen-reader-text">' . __( 'Play background video', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'play' ) );
  • src/wp-content/themes/twentyseventeen/inc/customizer.php

     
    123123
    124124/**
    125125 * Sanitize the page layout options.
     126 *
     127 * @param string $input Page layout
    126128 */
    127129function twentyseventeen_sanitize_page_layout( $input ) {
    128130        $valid = array(
     
    139141
    140142/**
    141143 * Sanitize the colorscheme.
     144 * @param string $input Color scheme
    142145 */
    143146function twentyseventeen_sanitize_colorscheme( $input ) {
    144147        $valid = array( 'light', 'dark', 'custom' );
    145148
    146         if ( in_array( $input, $valid ) ) {
     149        if ( in_array( $input, $valid, true ) ) {
    147150                return $input;
    148151        }
    149152
  • src/wp-content/themes/twentyseventeen/inc/template-tags.php

     
    1010 */
    1111
    1212if ( ! function_exists( 'twentyseventeen_posted_on' ) ) :
    13 /**
    14  * Prints HTML with meta information for the current post-date/time and author.
    15  */
    16 function twentyseventeen_posted_on() {
     13        /**
     14        * Prints HTML with meta information for the current post-date/time and author.
     15        */
     16        function twentyseventeen_posted_on() {
    1717
    18         // Get the author name; wrap it in a link.
    19         $byline = sprintf(
    20                 /* translators: %s: post author */
    21                 __( 'by %s', 'twentyseventeen' ),
    22                 '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . get_the_author() . '</a></span>'
    23         );
     18                // Get the author name; wrap it in a link.
     19                $byline = sprintf(
     20                        /* translators: %s: post author */
     21                        __( 'by %s', 'twentyseventeen' ),
     22                        '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . get_the_author() . '</a></span>'
     23                );
    2424
    25         // Finally, let's write all of this to the page.
    26         echo '<span class="posted-on">' . twentyseventeen_time_link() . '</span><span class="byline"> ' . $byline . '</span>';
    27 }
     25                // Finally, let's write all of this to the page.
     26                echo '<span class="posted-on">' . twentyseventeen_time_link() . '</span><span class="byline"> ' . $byline . '</span>';
     27        }
    2828endif;
    2929
    3030
    3131if ( ! function_exists( 'twentyseventeen_time_link' ) ) :
    32 /**
    33  * Gets a nicely formatted string for the published date.
    34  */
    35 function twentyseventeen_time_link() {
    36         $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
    37         if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    38                 $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
    39         }
     32        /**
     33        * Gets a nicely formatted string for the published date.
     34        */
     35        function twentyseventeen_time_link() {
     36                $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     37                if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
     38                        $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
     39                }
    4040
    41         $time_string = sprintf( $time_string,
    42                 get_the_date( DATE_W3C ),
    43                 get_the_date(),
    44                 get_the_modified_date( DATE_W3C ),
    45                 get_the_modified_date()
    46         );
     41                $time_string = sprintf( $time_string,
     42                        get_the_date( DATE_W3C ),
     43                        get_the_date(),
     44                        get_the_modified_date( DATE_W3C ),
     45                        get_the_modified_date()
     46                );
    4747
    48         // Wrap the time string in a link, and preface it with 'Posted on'.
    49         return sprintf(
    50                 /* translators: %s: post date */
    51                 __( '<span class="screen-reader-text">Posted on</span> %s', 'twentyseventeen' ),
    52                 '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
    53         );
    54 }
     48                // Wrap the time string in a link, and preface it with 'Posted on'.
     49                return sprintf(
     50                        /* translators: %s: post date */
     51                        __( '<span class="screen-reader-text">Posted on</span> %s', 'twentyseventeen' ),
     52                        '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
     53                );
     54        }
    5555endif;
    5656
    5757
    5858if ( ! function_exists( 'twentyseventeen_entry_footer' ) ) :
    59 /**
    60  * Prints HTML with meta information for the categories, tags and comments.
    61  */
    62 function twentyseventeen_entry_footer() {
     59        /**
     60        * Prints HTML with meta information for the categories, tags and comments.
     61        */
     62        function twentyseventeen_entry_footer() {
    6363
    64         /* translators: used between list items, there is a space after the comma */
    65         $separate_meta = __( ', ', 'twentyseventeen' );
     64                /* translators: used between list items, there is a space after the comma */
     65                $separate_meta = __( ', ', 'twentyseventeen' );
    6666
    67         // Get Categories for posts.
    68         $categories_list = get_the_category_list( $separate_meta );
     67                // Get Categories for posts.
     68                $categories_list = get_the_category_list( $separate_meta );
    6969
    70         // Get Tags for posts.
    71         $tags_list = get_the_tag_list( '', $separate_meta );
     70                // Get Tags for posts.
     71                $tags_list = get_the_tag_list( '', $separate_meta );
    7272
    73         // We don't want to output .entry-footer if it will be empty, so make sure its not.
    74         if ( ( ( twentyseventeen_categorized_blog() && $categories_list ) || $tags_list ) || get_edit_post_link() ) {
     73                // We don't want to output .entry-footer if it will be empty, so make sure its not.
     74                if ( ( ( twentyseventeen_categorized_blog() && $categories_list ) || $tags_list ) || get_edit_post_link() ) {
    7575
    76                 echo '<footer class="entry-footer">';
     76                        echo '<footer class="entry-footer">';
    7777
    78                         if ( 'post' === get_post_type() ) {
    79                                 if ( ( $categories_list && twentyseventeen_categorized_blog() ) || $tags_list ) {
    80                                         echo '<span class="cat-tags-links">';
     78                                if ( 'post' === get_post_type() ) {
     79                                        if ( ( $categories_list && twentyseventeen_categorized_blog() ) || $tags_list ) {
     80                                                echo '<span class="cat-tags-links">';
    8181
    82                                                 // Make sure there's more than one category before displaying.
    83                                                 if ( $categories_list && twentyseventeen_categorized_blog() ) {
    84                                                         echo '<span class="cat-links">' . twentyseventeen_get_svg( array( 'icon' => 'folder-open' ) ) . '<span class="screen-reader-text">' . __( 'Categories', 'twentyseventeen' ) . '</span>' . $categories_list . '</span>';
    85                                                 }
     82                                                        // Make sure there's more than one category before displaying.
     83                                                        if ( $categories_list && twentyseventeen_categorized_blog() ) {
     84                                                                echo '<span class="cat-links">' . twentyseventeen_get_svg( array( 'icon' => 'folder-open' ) ) . '<span class="screen-reader-text">' . __( 'Categories', 'twentyseventeen' ) . '</span>' . $categories_list . '</span>';
     85                                                        }
    8686
    87                                                 if ( $tags_list ) {
    88                                                         echo '<span class="tags-links">' . twentyseventeen_get_svg( array( 'icon' => 'hashtag' ) ) . '<span class="screen-reader-text">' . __( 'Tags', 'twentyseventeen' ) . '</span>' . $tags_list . '</span>';
    89                                                 }
     87                                                        if ( $tags_list ) {
     88                                                                echo '<span class="tags-links">' . twentyseventeen_get_svg( array( 'icon' => 'hashtag' ) ) . '<span class="screen-reader-text">' . __( 'Tags', 'twentyseventeen' ) . '</span>' . $tags_list . '</span>';
     89                                                        }
    9090
    91                                         echo '</span>';
     91                                                echo '</span>';
     92                                        }
    9293                                }
    93                         }
    9494
    95                         twentyseventeen_edit_link();
     95                                twentyseventeen_edit_link();
    9696
    97                 echo '</footer> <!-- .entry-footer -->';
     97                        echo '</footer> <!-- .entry-footer -->';
     98                }
    9899        }
    99 }
    100100endif;
    101101
    102102
    103103if ( ! function_exists( 'twentyseventeen_edit_link' ) ) :
    104 /**
    105  * Returns an accessibility-friendly link to edit a post or page.
    106  *
    107  * This also gives us a little context about what exactly we're editing
    108  * (post or page?) so that users understand a bit more where they are in terms
    109  * of the template hierarchy and their content. Helpful when/if the single-page
    110  * layout with multiple posts/pages shown gets confusing.
    111  */
    112 function twentyseventeen_edit_link() {
     104        /**
     105        * Returns an accessibility-friendly link to edit a post or page.
     106        *
     107        * This also gives us a little context about what exactly we're editing
     108        * (post or page?) so that users understand a bit more where they are in terms
     109        * of the template hierarchy and their content. Helpful when/if the single-page
     110        * layout with multiple posts/pages shown gets confusing.
     111        */
     112        function twentyseventeen_edit_link() {
    113113
    114         $link = edit_post_link(
    115                 sprintf(
    116                         /* translators: %s: Name of current post */
    117                         __( 'Edit<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
    118                         get_the_title()
    119                 ),
    120                 '<span class="edit-link">',
    121                 '</span>'
    122         );
     114                $link = edit_post_link(
     115                        sprintf(
     116                                /* translators: %s: Name of current post */
     117                                __( 'Edit<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
     118                                get_the_title()
     119                        ),
     120                        '<span class="edit-link">',
     121                        '</span>'
     122                );
    123123
    124         return $link;
    125 }
     124                return $link;
     125        }
    126126endif;
    127127
    128128/**
    129129 * Display a front page section.
    130130 *
    131  * @param $partial WP_Customize_Partial Partial associated with a selective refresh request.
    132  * @param $id integer Front page section to display.
     131 * @param WP_Customize_Partial $partial Partial associated with a selective refresh request.
     132 * @param integer              $id Front page section to display.
    133133 */
    134134function twentyseventeen_front_page_section( $partial = null, $id = 0 ) {
    135135        if ( is_a( $partial, 'WP_Customize_Partial' ) ) {
  • src/wp-content/themes/twentyseventeen/searchform.php

     
    77 * @since 1.0
    88 * @version 1.0
    99 */
     10
    1011?>
    1112
    1213<?php $unique_id = esc_attr( uniqid( 'search-form-' ) ); ?>
  • src/wp-content/themes/twentyseventeen/single.php

     
    1717                <main id="main" class="site-main" role="main">
    1818
    1919                        <?php
    20                                 /* Start the Loop */
    21                                 while ( have_posts() ) : the_post();
     20                        /* Start the Loop */
     21                        while ( have_posts() ) : the_post();
    2222
    23                                         get_template_part( 'template-parts/post/content', get_post_format() );
     23                                get_template_part( 'template-parts/post/content', get_post_format() );
    2424
    25                                         // If comments are open or we have at least one comment, load up the comment template.
    26                                         if ( comments_open() || get_comments_number() ) :
    27                                                 comments_template();
    28                                         endif;
     25                                // If comments are open or we have at least one comment, load up the comment template.
     26                                if ( comments_open() || get_comments_number() ) :
     27                                        comments_template();
     28                                endif;
    2929
    30                                         the_post_navigation( array(
    31                                                 'prev_text' => '<span class="screen-reader-text">' . __( 'Previous Post', 'twentyseventeen' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . __( 'Previous', 'twentyseventeen' ) . '</span> <span class="nav-title"><span class="nav-title-icon-wrapper">' . twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '</span>%title</span>',
    32                                                 'next_text' => '<span class="screen-reader-text">' . __( 'Next Post', 'twentyseventeen' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . __( 'Next', 'twentyseventeen' ) . '</span> <span class="nav-title">%title<span class="nav-title-icon-wrapper">' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ) . '</span></span>',
    33                                         ) );
     30                                the_post_navigation( array(
     31                                        'prev_text' => '<span class="screen-reader-text">' . __( 'Previous Post', 'twentyseventeen' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . __( 'Previous', 'twentyseventeen' ) . '</span> <span class="nav-title"><span class="nav-title-icon-wrapper">' . twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '</span>%title</span>',
     32                                        'next_text' => '<span class="screen-reader-text">' . __( 'Next Post', 'twentyseventeen' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . __( 'Next', 'twentyseventeen' ) . '</span> <span class="nav-title">%title<span class="nav-title-icon-wrapper">' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ) . '</span></span>',
     33                                ) );
    3434
    35                                 endwhile; // End of the loop.
     35                        endwhile; // End of the loop.
    3636                        ?>
    3737
    3838                </main><!-- #main -->
  • src/wp-content/themes/twentyseventeen/template-parts/header/site-branding.php

     
    2121                                <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
    2222                        <?php endif; ?>
    2323
    24                         <?php $description = get_bloginfo( 'description', 'display' );
    25                                 if ( $description || is_customize_preview() ) : ?>
    26                                         <p class="site-description"><?php echo $description; ?></p>
    27                                 <?php endif; ?>
     24                        <?php
     25                        $description = get_bloginfo( 'description', 'display' );
     26                       
     27                        if ( $description || is_customize_preview() ) :
     28                        ?>
     29                                <p class="site-description"><?php echo $description; ?></p>
     30                        <?php endif; ?>
    2831                </div><!-- .site-branding-text -->
    2932
    3033                <?php if ( ( twentyseventeen_is_frontpage() || ( is_home() && is_front_page() ) ) && ! has_nav_menu( 'top' ) ) : ?>
  • src/wp-content/themes/twentyseventeen/template-parts/navigation/navigation-top.php

     
    1010
    1111?>
    1212<nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php _e( 'Top Menu', 'twentyseventeen' ); ?>">
    13         <button class="menu-toggle" aria-controls="top-menu" aria-expanded="false"><?php echo twentyseventeen_get_svg( array( 'icon' => 'bars' ) ); echo twentyseventeen_get_svg( array( 'icon' => 'close' ) ); _e( 'Menu', 'twentyseventeen' ); ?></button>
     13        <button class="menu-toggle" aria-controls="top-menu" aria-expanded="false">
     14                <?php
     15                echo twentyseventeen_get_svg( array( 'icon' => 'bars' ) );
     16                echo twentyseventeen_get_svg( array( 'icon' => 'close' ) );
     17                _e( 'Menu', 'twentyseventeen' );
     18                ?>
     19        </button>
     20       
    1421        <?php wp_nav_menu( array(
    1522                'theme_location' => 'top',
    1623                'menu_id'        => 'top-menu',
  • src/wp-content/themes/twentyseventeen/template-parts/post/content-audio.

    old new  
    1414
    1515<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    1616        <?php
    17                 if ( is_sticky() && is_home() ) :
    18                         echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
    19                 endif;
     17        if ( is_sticky() && is_home() ) {
     18                echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
     19        }
    2020        ?>
    2121        <header class="entry-header">
    2222                <?php
    23                         if ( 'post' === get_post_type() ) :
    24                                 echo '<div class="entry-meta">';
    25                                         if ( is_single() ) :
    26                                                 twentyseventeen_posted_on();
    27                                         else :
    28                                                 echo twentyseventeen_time_link();
    29                                                 twentyseventeen_edit_link();
    30                                         endif;
    31                                 echo '</div><!-- .entry-meta -->';
    32                         endif;
     23                if ( 'post' === get_post_type() ) {
     24                        echo '<div class="entry-meta">';
     25                                if ( is_single() ) {
     26                                        twentyseventeen_posted_on();
     27                                } else {
     28                                        echo twentyseventeen_time_link();
     29                                        twentyseventeen_edit_link();
     30                                };
     31                        echo '</div><!-- .entry-meta -->';
     32                };
    3333
    34                         if ( is_single() ) {
    35                                 the_title( '<h1 class="entry-title">', '</h1>' );
    36                         } else {
    37                                 the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
    38                         }
     34                if ( is_single() ) {
     35                        the_title( '<h1 class="entry-title">', '</h1>' );
     36                } else {
     37                        the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
     38                }
    3939                ?>
    4040        </header><!-- .entry-header -->
    4141
    4242        <?php
    43                 $content = apply_filters( 'the_content', get_the_content() );
    44                 $audio = false;
     43        $content = apply_filters( 'the_content', get_the_content() );
     44        $audio = false;
    4545
    46                 // Only get audio from the content if a playlist isn't present.
    47                 if ( false === strpos( $content, 'wp-playlist-script' ) ) {
    48                         $audio = get_media_embedded_in_content( $content, array( 'audio' ) );
    49                 }
    50 
     46        // Only get audio from the content if a playlist isn't present.
     47        if ( false === strpos( $content, 'wp-playlist-script' ) ) {
     48                $audio = get_media_embedded_in_content( $content, array( 'audio' ) );
     49        }
    5150        ?>
    5251
    5352        <?php if ( '' !== get_the_post_thumbnail() && ! is_single() ) : ?>
     
    6059
    6160        <div class="entry-content">
    6261
    63                 <?php if ( ! is_single() ) :
     62                <?php
     63                if ( !is_single() ) {
    6464
    6565                        // If not a single post, highlight the audio file.
    66                         if ( ! empty( $audio ) ) :
     66                        if ( ! empty( $audio ) ) {
    6767                                foreach ( $audio as $audio_html ) {
    6868                                        echo '<div class="entry-audio">';
    6969                                                echo $audio_html;
    7070                                        echo '</div><!-- .entry-audio -->';
    7171                                }
    72                         endif;
     72                        };
    7373
    74                 endif;
     74                }
    7575
    76                 if ( is_single() || empty( $audio ) ) :
     76                if ( is_single() || empty( $audio ) ) {
    7777
    7878                        /* translators: %s: Name of current post */
    7979                        the_content( sprintf(
     
    8888                                'link_after'  => '</span>',
    8989                        ) );
    9090
    91                 endif; ?>
     91                };
     92                ?>
    9293
    9394        </div><!-- .entry-content -->
    9495
    95         <?php if ( is_single() ) : ?>
    96                 <?php twentyseventeen_entry_footer(); ?>
    97         <?php endif; ?>
     96        <?php
     97        if ( is_single() ) {
     98                twentyseventeen_entry_footer();
     99        }
     100        ?>
    98101
    99 </article><!-- #post-## -->
     102</article><!-- #post-## -->
     103 No newline at end of file
  • src/wp-content/themes/twentyseventeen/template-parts/post/content-gallery.php

     
    99 * @since 1.0
    1010 * @version 1.0
    1111 */
     12
    1213?>
    1314
    1415<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    1516        <?php
    16                 if ( is_sticky() && is_home() ) :
    17                         echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
    18                 endif;
     17        if ( is_sticky() && is_home() ) {
     18                echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
     19        }
    1920        ?>
    2021        <header class="entry-header">
    2122                <?php
    22                         if ( 'post' === get_post_type() ) :
    23                                 echo '<div class="entry-meta">';
    24                                         if ( is_single() ) :
    25                                                 twentyseventeen_posted_on();
    26                                         else :
    27                                                 echo twentyseventeen_time_link();
    28                                                 twentyseventeen_edit_link();
    29                                         endif;
    30                                 echo '</div><!-- .entry-meta -->';
    31                         endif;
     23                if ( 'post' === get_post_type() ) {
     24                        echo '<div class="entry-meta">';
     25                                if ( is_single() ) {
     26                                        twentyseventeen_posted_on();
     27                                } else {
     28                                        echo twentyseventeen_time_link();
     29                                        twentyseventeen_edit_link();
     30                                };
     31                        echo '</div><!-- .entry-meta -->';
     32                };
    3233
    33                         if ( is_single() ) {
    34                                 the_title( '<h1 class="entry-title">', '</h1>' );
    35                         } else {
    36                                 the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
    37                         }
     34                if ( is_single() ) {
     35                        the_title( '<h1 class="entry-title">', '</h1>' );
     36                } else {
     37                        the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
     38                }
    3839                ?>
    3940        </header><!-- .entry-header -->
    4041
     
    4849
    4950        <div class="entry-content">
    5051
    51                 <?php if ( ! is_single() ) :
     52                <?php
     53                if ( ! is_single() ) {
    5254
    5355                        // If not a single post, highlight the gallery.
    54                         if ( get_post_gallery() ) :
     56                        if ( get_post_gallery() ) {
    5557                                echo '<div class="entry-gallery">';
    5658                                        echo get_post_gallery();
    5759                                echo '</div>';
    58                         endif;
     60                        };
    5961
    60                 endif;
     62                };
    6163
    62                 if ( is_single() || ! get_post_gallery() ) :
     64                if ( is_single() || ! get_post_gallery() ) {
    6365
    6466                        /* translators: %s: Name of current post */
    6567                        the_content( sprintf(
     
    7476                                'link_after'  => '</span>',
    7577                        ) );
    7678
    77                 endif; ?>
     79                };
     80                ?>
    7881
    7982        </div><!-- .entry-content -->
    8083
    81         <?php if ( is_single() ) : ?>
    82                 <?php twentyseventeen_entry_footer(); ?>
    83         <?php endif; ?>
     84        <?php
     85        if ( is_single() ) {
     86                twentyseventeen_entry_footer();
     87        }
     88        ?>
    8489
    8590</article><!-- #post-## -->
  • src/wp-content/themes/twentyseventeen/template-parts/post/content-image.

    old new  
    99 * @since 1.0
    1010 * @version 1.0
    1111 */
     12
    1213?>
    1314
    1415<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    1516        <?php
    16                 if ( is_sticky() && is_home() ) :
    17                         echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
    18                 endif;
     17        if ( is_sticky() && is_home() ) {
     18                echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
     19        }
    1920        ?>
    2021        <header class="entry-header">
    2122                <?php
    22                         if ( 'post' === get_post_type() ) :
     23                        if ( 'post' === get_post_type() ) {
    2324                                echo '<div class="entry-meta">';
    24                                         if ( is_single() ) :
     25                                        if ( is_single() ) {
    2526                                                twentyseventeen_posted_on();
    26                                         else :
     27                                        } else {
    2728                                                echo twentyseventeen_time_link();
    2829                                                twentyseventeen_edit_link();
    29                                         endif;
     30                                        };
    3031                                echo '</div><!-- .entry-meta -->';
    31                         endif;
     32                        };
    3233
    3334                        if ( is_single() ) {
    3435                                the_title( '<h1 class="entry-title">', '</h1>' );
     
    4849
    4950        <div class="entry-content">
    5051
    51                 <?php if ( is_single() || '' === get_the_post_thumbnail() ) :
     52                <?php
     53                if ( is_single() || '' === get_the_post_thumbnail() ) {
    5254
    5355                        // Only show content if is a single post, or if there's no featured image.
    5456                        /* translators: %s: Name of current post */
     
    6466                                'link_after'  => '</span>',
    6567                        ) );
    6668
    67                 endif; ?>
     69                }
     70                ?>
    6871
    6972        </div><!-- .entry-content -->
    7073
    71         <?php if ( is_single() ) : ?>
    72                 <?php twentyseventeen_entry_footer(); ?>
    73         <?php endif; ?>
     74        <?php
     75        if ( is_single() ) {
     76                twentyseventeen_entry_footer();
     77        }
     78        ?>
    7479
    7580</article><!-- #post-## -->
  • src/wp-content/themes/twentyseventeen/template-parts/post/content-video.

    old new  
    99 * @since 1.0
    1010 * @version 1.0
    1111 */
     12
    1213?>
    1314
    1415<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    1516        <?php
    16                 if ( is_sticky() && is_home() ) :
    17                         echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
    18                 endif;
     17        if ( is_sticky() && is_home() ) {
     18                echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
     19        }
    1920        ?>
    2021        <header class="entry-header">
    2122                <?php
    22                         if ( 'post' === get_post_type() ) :
    23                                 echo '<div class="entry-meta">';
    24                                         if ( is_single() ) :
    25                                                 twentyseventeen_posted_on();
    26                                         else :
    27                                                 echo twentyseventeen_time_link();
    28                                                 twentyseventeen_edit_link();
    29                                         endif;
    30                                 echo '</div><!-- .entry-meta -->';
    31                         endif;
     23                if ( 'post' === get_post_type() ) {
     24                        echo '<div class="entry-meta">';
     25                                if ( is_single() ) {
     26                                        twentyseventeen_posted_on();
     27                                } else {
     28                                        echo twentyseventeen_time_link();
     29                                        twentyseventeen_edit_link();
     30                                };
     31                        echo '</div><!-- .entry-meta -->';
     32                };
    3233
    33                         if ( is_single() ) {
    34                                 the_title( '<h1 class="entry-title">', '</h1>' );
    35                         } else {
    36                                 the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
    37                         }
     34                if ( is_single() ) {
     35                        the_title( '<h1 class="entry-title">', '</h1>' );
     36                } else {
     37                        the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
     38                }
    3839                ?>
    3940        </header><!-- .entry-header -->
    4041
     
    5859
    5960        <div class="entry-content">
    6061
    61                 <?php if ( ! is_single() ) :
     62                <?php
     63                if ( ! is_single() ) {
    6264
    6365                        // If not a single post, highlight the video file.
    64                         if ( ! empty( $video ) ) :
     66                        if ( ! empty( $video ) ) {
    6567                                foreach ( $video as $video_html ) {
    6668                                        echo '<div class="entry-video">';
    6769                                                echo $video_html;
    6870                                        echo '</div>';
    6971                                }
    70                         endif;
     72                        };
    7173
    72                 endif;
     74                };
    7375
    74                 if ( is_single() || empty( $video ) ) :
     76                if ( is_single() || empty( $video ) ) {
    7577
    7678                        /* translators: %s: Name of current post */
    7779                        the_content( sprintf(
     
    8688                                'link_after'  => '</span>',
    8789                        ) );
    8890
    89                 endif; ?>
     91                };
     92                ?>
    9093
    9194        </div><!-- .entry-content -->
    9295
    93         <?php if ( is_single() ) : ?>
    94                 <?php twentyseventeen_entry_footer(); ?>
    95         <?php endif; ?>
     96        <?php
     97        if ( is_single() ) {
     98                twentyseventeen_entry_footer();
     99        }
     100        ?>
    96101
    97102</article><!-- #post-## -->
  • src/wp-content/themes/twentyseventeen/template-parts/post/content.php

     
    1414
    1515<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    1616        <?php
    17                 if ( is_sticky() && is_home() ) :
    18                         echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
    19                 endif;
     17        if ( is_sticky() && is_home() ) :
     18                echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
     19        endif;
    2020        ?>
    2121        <header class="entry-header">
    2222                <?php
    23                         if ( 'post' === get_post_type() ) :
    24                                 echo '<div class="entry-meta">';
    25                                         if ( is_single() ) :
    26                                                 twentyseventeen_posted_on();
    27                                         else :
    28                                                 echo twentyseventeen_time_link();
    29                                                 twentyseventeen_edit_link();
    30                                         endif;
    31                                 echo '</div><!-- .entry-meta -->';
    32                         endif;
     23                if ( 'post' === get_post_type() ) {
     24                        echo '<div class="entry-meta">';
     25                                if ( is_single() ) {
     26                                        twentyseventeen_posted_on();
     27                                } else {
     28                                        echo twentyseventeen_time_link();
     29                                        twentyseventeen_edit_link();
     30                                };
     31                        echo '</div><!-- .entry-meta -->';
     32                };
    3333
    34                         if ( is_single() ) {
    35                                 the_title( '<h1 class="entry-title">', '</h1>' );
    36                         } else {
    37                                 the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
    38                         }
     34                if ( is_single() ) {
     35                        the_title( '<h1 class="entry-title">', '</h1>' );
     36                } else {
     37                        the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
     38                }
    3939                ?>
    4040        </header><!-- .entry-header -->
    4141
     
    4949
    5050        <div class="entry-content">
    5151                <?php
    52                         /* translators: %s: Name of current post */
    53                         the_content( sprintf(
    54                                 __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
    55                                 get_the_title()
    56                         ) );
     52                /* translators: %s: Name of current post */
     53                the_content( sprintf(
     54                        __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
     55                        get_the_title()
     56                ) );
    5757
    58                         wp_link_pages( array(
    59                                 'before'      => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
    60                                 'after'       => '</div>',
    61                                 'link_before' => '<span class="page-number">',
    62                                 'link_after'  => '</span>',
    63                         ) );
     58                wp_link_pages( array(
     59                        'before'      => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
     60                        'after'       => '</div>',
     61                        'link_before' => '<span class="page-number">',
     62                        'link_after'  => '</span>',
     63                ) );
    6464                ?>
    6565        </div><!-- .entry-content -->
    6666
    67         <?php if ( is_single() ) : ?>
    68                 <?php twentyseventeen_entry_footer(); ?>
    69         <?php endif; ?>
     67        <?php
     68        if ( is_single() ) {
     69                twentyseventeen_entry_footer();
     70        }
     71        ?>
    7072
    7173</article><!-- #post-## -->