diff --git a/includes/sp-formatting-functions.php b/includes/sp-formatting-functions.php index 407a3058..6f2a6018 100644 --- a/includes/sp-formatting-functions.php +++ b/includes/sp-formatting-functions.php @@ -63,6 +63,17 @@ function sp_array_overlay( $a1, $a2 ) { return $a1; } +/** + * Array filter returns positive values only. + * + * @access public + * @param int $var + * @return bool + */ +function sp_filter_positive( $var = 0 ) { + return $var > 0; +} + /** * let_to_num function. * diff --git a/templates/event-logos.php b/templates/event-logos.php index eff49850..263ed022 100644 --- a/templates/event-logos.php +++ b/templates/event-logos.php @@ -14,7 +14,7 @@ if ( ! isset( $id ) ) $id = get_the_ID(); $teams = get_post_meta( $id, 'sp_team' ); -$teams = array_filter( $teams ); +$teams = array_filter( $teams, 'sp_filter_positive' ); if ( $teams ): $team_logos = array(); foreach ( $teams as $team ):