From c0d085ba664da9aa91fa502d3eba8c1e5d390b09 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sun, 3 Apr 2016 10:56:25 +1000 Subject: [PATCH] Filter body class based on layout settings --- includes/sp-template-functions.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/sp-template-functions.php b/includes/sp-template-functions.php index 92b221a5..27c7888d 100644 --- a/includes/sp-template-functions.php +++ b/includes/sp-template-functions.php @@ -48,11 +48,16 @@ function sp_body_class( $classes ) { if ( 'sp_event' == $post_type ) { $id = get_the_ID(); - if ( get_option( 'sportspress_event_show_maps', 'yes' ) == 'yes' && get_the_terms( $id, 'sp_venue' ) ) { - $classes[] = 'sp-has-venue'; + $show_venue = get_option( 'sportspress_event_show_venue', 'yes' ) == 'yes' ? true : false; + if ( $show_venue && get_the_terms( $id, 'sp_venue' ) ) { + if ( get_option( 'sportspress_event_show_maps', 'yes' ) == 'yes' ) { + $classes[] = 'sp-has-venue'; + } } if ( 'results' == sp_get_status( $id ) ) { - $classes[] = 'sp-has-results'; + if ( get_option( 'sportspress_event_show_results', 'yes' ) == 'yes' ) { + $classes[] = 'sp-has-results'; + } } } elseif ( 'sp_team' == $post_type && 'yes' == get_option( 'sportspress_team_show_logo', 'yes' ) ) { $classes[] = 'sp-show-image';