Making WordPress.org

Changeset 8368


Ignore:
Timestamp:
02/28/2019 06:32:42 AM (5 years ago)
Author:
dd32
Message:

WordPress.TV: Avoid a PHP Warning when a video doesn't have any assigned Speakers (there are a few).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/archive.php

    r6374 r8368  
    6363                    <?php
    6464                        $wptv->the_terms( 'event', '<span class="video-events">', ', ', '</span>', false );
    65                         $label = _n( 'Speaker:', 'Speakers:', count( get_the_terms( $post->ID, 'speakers' ) ), 'wptv' );
    66                         $wptv->the_terms( 'speakers', '<span class="video-speakers"><strong>' . $label . '</strong> ', ', ', '</span>', false );
     65                        $speakers = get_the_terms( $post->ID, 'speakers' );
     66                        if ( $speakers ) {
     67                            $label = _n( 'Speaker:', 'Speakers:', count( $speakers ), 'wptv' );
     68                            $wptv->the_terms( 'speakers', '<span class="video-speakers"><strong>' . $label . '</strong> ', ', ', '</span>', false );
     69                        }
    6770                    ?>
    6871                    <span class="video-excerpt">
Note: See TracChangeset for help on using the changeset viewer.