From 21847d247179e2b6d2786e672fd3793c5813900c Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Fri, 18 Sep 2015 11:11:45 +1000 Subject: [PATCH] Hide featured image if image is loaded in template --- assets/css/sportspress.css | 12 ++++++------ includes/sp-template-functions.php | 12 ++++++++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/assets/css/sportspress.css b/assets/css/sportspress.css index a66e3252..e1dbbac8 100644 --- a/assets/css/sportspress.css +++ b/assets/css/sportspress.css @@ -124,14 +124,14 @@ } /* Featured Image */ -.single-sp_team .wp-post-image, -.single-sp_player .wp-post-image, -.single-sp_staff .wp-post-image { +.single-sp_team.sp-show-image .wp-post-image, +.single-sp_player.sp-show-image .wp-post-image, +.single-sp_staff.sp-show-image .wp-post-image { display: none; } -.single-sp_team .sp-template .wp-post-image, -.single-sp_player .sp-template .wp-post-image, -.single-sp_staff .sp-template .wp-post-image { +.single-sp_team.sp-show-image .sp-template .wp-post-image, +.single-sp_player.sp-show-image .sp-template .wp-post-image, +.single-sp_staff.sp-show-image .sp-template .wp-post-image { display: block; } diff --git a/includes/sp-template-functions.php b/includes/sp-template-functions.php index cfe2d5cc..a4a40e98 100644 --- a/includes/sp-template-functions.php +++ b/includes/sp-template-functions.php @@ -44,7 +44,9 @@ function sp_body_class( $classes ) { $classes[] = 'sportspress-page'; } - if ( 'sp_event' == get_post_type() ) { + $post_type = get_post_type(); + + 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'; @@ -52,6 +54,12 @@ function sp_body_class( $classes ) { if ( 'results' == sp_get_status( $id ) ) { $classes[] = 'sp-has-results'; } + } elseif ( 'sp_team' == $post_type && 'yes' == get_option( 'sportspress_team_show_logo', 'yes' ) ) { + $classes[] = 'sp-show-image'; + } elseif ( 'sp_player' == $post_type && 'yes' == get_option( 'sportspress_player_show_photo', 'yes' ) ) { + $classes[] = 'sp-show-image'; + } elseif ( 'sp_staff' == $post_type && 'yes' == get_option( 'sportspress_staff_show_photo', 'yes' ) ) { + $classes[] = 'sp-show-image'; } return array_unique( $classes ); @@ -290,7 +298,7 @@ if ( ! function_exists( 'sportspress_output_league_table' ) ) { * @return void */ function sportspress_output_league_table() { - sp_get_template( 'league-table.php' ); + sp_get_template( 'league-table.php', array( 'title' => __( 'League Table', 'sportspress' ) ) ); } }