Make WordPress Core

Ticket #45424: 45424.16.patch

File 45424.16.patch, 1.3 KB (added by allancole, 6 years ago)

Fix PHP Warning: Parameter must be an array or an object that implements Countable. More info here: https://github.com/WordPress/twentynineteen/pull/661

  • src/wp-content/themes/twentynineteen/header.php

     
    3131
    3232                        <?php if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) : ?>
    3333                                <div class="site-featured-image">
    34                                         <?php twentynineteen_post_thumbnail(); ?>
    35                                         <?php the_post(); ?>
    36                                         <?php $discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null; ?>
    37                                         <div class="<?php echo ( ! empty( $discussion ) && count( $discussion->responses ) > 0 ) ? 'entry-header has-discussion' : 'entry-header'; ?>">
     34                                        <?php
     35                                                twentynineteen_post_thumbnail();
     36                                                the_post();
     37                                                $discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null;
     38
     39                                                $classes = 'entry-header';
     40                                                if ( ! empty( $discussion ) && absint( $discussion->responses ) > 0 ) {
     41                                                        $classes = 'entry-header has-discussion';
     42                                                }
     43                                        ?>
     44                                        <div class="<?php echo $classes; ?>">
    3845                                                <?php get_template_part( 'template-parts/header/entry', 'header' ); ?>
    3946                                        </div><!-- .entry-header -->
    4047                                        <?php rewind_posts(); ?>