Fix notice by checking if terms exist

This commit is contained in:
Brian Miyaji
2014-09-05 22:04:51 +10:00
parent eda0b37a2b
commit b26cf398ce

View File

@@ -171,18 +171,18 @@ endif;
if ( $usecolumns == null || in_array( 'league', $usecolumns ) ): if ( $usecolumns == null || in_array( 'league', $usecolumns ) ):
echo '<td class="data-league">'; echo '<td class="data-league">';
$leagues = get_the_terms( $event->ID, 'sp_league' ); $leagues = get_the_terms( $event->ID, 'sp_league' );
foreach ( $leagues as $league ): if ( $leagues ): foreach ( $leagues as $league ):
echo $league->name; echo $league->name;
endforeach; endforeach; endif;
echo '</td>'; echo '</td>';
endif; endif;
if ( $usecolumns == null || in_array( 'season', $usecolumns ) ): if ( $usecolumns == null || in_array( 'season', $usecolumns ) ):
echo '<td class="data-season">'; echo '<td class="data-season">';
$seasons = get_the_terms( $event->ID, 'sp_season' ); $seasons = get_the_terms( $event->ID, 'sp_season' );
foreach ( $seasons as $season ): if ( $seasons ): foreach ( $seasons as $season ):
echo $season->name; echo $season->name;
endforeach; endforeach; endif;
echo '</td>'; echo '</td>';
endif; endif;
@@ -192,9 +192,9 @@ endif;
the_terms( $event->ID, 'sp_venue' ); the_terms( $event->ID, 'sp_venue' );
else: else:
$venues = get_the_terms( $event->ID, 'sp_venue' ); $venues = get_the_terms( $event->ID, 'sp_venue' );
foreach ( $venues as $venue ): if ( $venues ): foreach ( $venues as $venue ):
echo $venue->name; echo $venue->name;
endforeach; endforeach; endif;
endif; endif;
echo '</td>'; echo '</td>';
endif; endif;