Add option to show or hide logos or photos in event blocks

This commit is contained in:
Brian Miyaji
2016-05-24 16:54:32 +10:00
parent 3ec2eca9de
commit 9ca1e03448
3 changed files with 27 additions and 15 deletions

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add event calendars to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.0
Version: 2.0.7
*/
// Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Calendars' ) ) :
* Main SportsPress Calendars Class
*
* @class SportsPress_Calendars
* @version 2.0
* @version 2.0.7
*/
class SportsPress_Calendars {
@@ -49,7 +49,7 @@ class SportsPress_Calendars {
*/
private function define_constants() {
if ( !defined( 'SP_CALENDARS_VERSION' ) )
define( 'SP_CALENDARS_VERSION', '2.0' );
define( 'SP_CALENDARS_VERSION', '2.0.7' );
if ( !defined( 'SP_CALENDARS_URL' ) )
define( 'SP_CALENDARS_URL', plugin_dir_url( __FILE__ ) );
@@ -311,6 +311,14 @@ class SportsPress_Calendars {
'type' => 'checkbox',
),
array(
'title' => __( 'Teams', 'sportspress' ),
'desc' => __( 'Display logos', 'sportspress' ),
'id' => 'sportspress_event_blocks_show_logos',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'title' => __( 'Details', 'sportspress' ),
'desc' => __( 'Display competition', 'sportspress' ),

View File

@@ -240,6 +240,7 @@ When you upgrade to one of the SportsPress Pro licenses, you can simply activate
== Changelog ==
= 2.0.7 =
* Feature - Add option to show or hide logos or photos in event blocks.
* Tweak - Combine reverse teams option for results and box score.
* Fix - Add filter to template output for extensions.

View File

@@ -4,7 +4,7 @@
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 2.0
* @version 2.0.7
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -21,6 +21,7 @@ $defaults = array(
'venue' => null,
'team' => null,
'number' => -1,
'show_team_logo' => get_option( 'sportspress_event_blocks_show_logos', 'yes' ) == 'yes' ? true : false,
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
'paginated' => get_option( 'sportspress_event_blocks_paginated', 'yes' ) == 'yes' ? true : false,
@@ -91,18 +92,20 @@ if ( $title )
$teams = array_filter( $teams, 'sp_filter_positive' );
$logos = array();
$j = 0;
foreach( $teams as $team ):
$j++;
if ( has_post_thumbnail ( $team ) ):
if ( $link_teams ):
$logo = '<a class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" href="' . get_permalink( $team, false, true ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</a>';
else:
$logo = '<span class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</span>';
if ( $show_team_logo ):
$j = 0;
foreach( $teams as $team ):
$j++;
if ( has_post_thumbnail ( $team ) ):
if ( $link_teams ):
$logo = '<a class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" href="' . get_permalink( $team, false, true ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</a>';
else:
$logo = '<span class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</span>';
endif;
$logos[] = $logo;
endif;
$logos[] = $logo;
endif;
endforeach;
endforeach;
endif;
?>
<tr class="sp-row sp-post<?php echo ( $i % 2 == 0 ? ' alternate' : '' ); ?>">
<td>