Add countdown module with team logos option

This commit is contained in:
Brian Miyaji
2015-02-13 18:57:42 +11:00
parent 72815b6960
commit 7e0dbb385f
10 changed files with 163 additions and 8 deletions

View File

@@ -4,7 +4,7 @@
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 1.6
* @version 1.6.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -14,6 +14,8 @@ $defaults = array(
'id' => null,
'live' => get_option( 'sportspress_enable_live_countdowns', 'yes' ) == 'yes' ? true : false,
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
'show_logos' => get_option( 'sportspress_countdown_show_logos', 'no' ) == 'yes' ? true : false,
);
if ( isset( $id ) ):
@@ -34,7 +36,26 @@ if ( $link_events ) $title = '<a href="' . get_permalink( $post->ID ) . '">' . $
?>
<div class="sp-template sp-template-countdown">
<div class="sp-countdown-wrapper">
<h3 class="event-name"><?php echo $title; ?></a></h3>
<h3 class="event-name">
<?php
if ( $show_logos ) {
$teams = array_unique( get_post_meta( $post->ID, 'sp_team' ) );
$i = 0;
foreach ( $teams as $team ) {
$i++;
if ( has_post_thumbnail ( $team ) ) {
if ( $link_teams ) {
echo '<a class="team-logo logo-' . ( $i % 2 ? 'odd' : 'even' ) . '" href="' . get_post_permalink( $team ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</a>';
} else {
echo get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $i % 2 ? 'odd' : 'even' ) ) );
}
}
}
}
?>
<?php echo $title; ?>
</h3>
<?php
if ( isset( $show_venue ) && $show_venue ):
$venues = get_the_terms( $post->ID, 'sp_venue' );