Display team logos in event only if logos exist
This commit is contained in:
@@ -123,14 +123,16 @@ function sportspress_the_title( $title, $id = null ) {
|
|||||||
$teams = get_post_meta( $id, 'sp_team' );
|
$teams = get_post_meta( $id, 'sp_team' );
|
||||||
$teams = array_filter( $teams );
|
$teams = array_filter( $teams );
|
||||||
if ( $teams ):
|
if ( $teams ):
|
||||||
$title .= '<div class="sp-event-teams">';
|
|
||||||
$delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' );
|
|
||||||
$team_logos = array();
|
$team_logos = array();
|
||||||
foreach ( $teams as $team ):
|
foreach ( $teams as $team ):
|
||||||
$team_logos[] = get_the_post_thumbnail( $team, 'sportspress-fit-icon' );
|
$team_logos[] = get_the_post_thumbnail( $team, 'sportspress-fit-icon' );
|
||||||
endforeach;
|
endforeach;
|
||||||
$title .= implode( ' ' . $delimiter . ' ', $team_logos );
|
if ( ! empty( array_filter( $team_logos ) ) ):
|
||||||
$title .= '</div>';
|
$title .= '<div class="sp-event-teams">';
|
||||||
|
$delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' );
|
||||||
|
$title .= implode( ' ' . $delimiter . ' ', $team_logos );
|
||||||
|
$title .= '</div>';
|
||||||
|
endif;
|
||||||
endif;
|
endif;
|
||||||
endif;
|
endif;
|
||||||
endif;
|
endif;
|
||||||
|
|||||||
Reference in New Issue
Block a user