diff --git a/assets/css/sportspress.css b/assets/css/sportspress.css index 41979724..06dc889e 100644 --- a/assets/css/sportspress.css +++ b/assets/css/sportspress.css @@ -250,6 +250,33 @@ padding: 0; } +/* Countdowns */ +.sp-template-countdown .event-name { + overflow: auto; +} +.sp-template-countdown .team-logo { + width: 20%; + height: auto; + max-width: 4em; +} +.sp-template-countdown .logo-odd { + float: left; + margin-right: 10px; +} +.sp-template-countdown .logo-even { + float: right; + margin-left: 10px; +} +.sp-template-countdown .team-logo img { + max-width: 100%; + max-height: 100%; + width: auto; + height: auto; +} +.sp-template-countdown .sp-countdown { + clear: both; +} + /* Google Maps */ .sp-google-map { height: 320px; diff --git a/assets/fonts/sportspress.eot b/assets/fonts/sportspress.eot index 432ebdcf..684f8fca 100755 Binary files a/assets/fonts/sportspress.eot and b/assets/fonts/sportspress.eot differ diff --git a/assets/fonts/sportspress.svg b/assets/fonts/sportspress.svg index ebd58ac3..a5eacbcf 100755 --- a/assets/fonts/sportspress.svg +++ b/assets/fonts/sportspress.svg @@ -10,7 +10,6 @@ - @@ -20,7 +19,6 @@ - @@ -30,7 +28,8 @@ - + + diff --git a/assets/fonts/sportspress.ttf b/assets/fonts/sportspress.ttf index aaac5e2b..ff5ce3c6 100755 Binary files a/assets/fonts/sportspress.ttf and b/assets/fonts/sportspress.ttf differ diff --git a/assets/fonts/sportspress.woff b/assets/fonts/sportspress.woff index a157933d..ae7e02ae 100755 Binary files a/assets/fonts/sportspress.woff and b/assets/fonts/sportspress.woff differ diff --git a/assets/js/admin/editor-lang.php b/assets/js/admin/editor-lang.php index 19ee8824..8895a5e7 100644 --- a/assets/js/admin/editor-lang.php +++ b/assets/js/admin/editor-lang.php @@ -4,7 +4,7 @@ $shortcodes = ''; $options = array( 'event' => array( - 'details', 'results', 'performance', 'countdown' + 'details', 'results', 'performance' ), 'player' => array( 'details', 'statistics' diff --git a/includes/class-sp-modules.php b/includes/class-sp-modules.php index 5e675295..53aca1ce 100644 --- a/includes/class-sp-modules.php +++ b/includes/class-sp-modules.php @@ -5,7 +5,7 @@ * The SportsPress modules class stores available modules. * * @class SP_Modules - * @version 1.6 + * @version 1.6.1 * @package SportsPress/Classes * @category Class * @author ThemeBoy @@ -32,6 +32,10 @@ class SP_Modules { 'label' => __( 'Videos', 'sportspress' ), 'icon' => 'dashicons dashicons-video-alt', ), + 'countdowns' => array( + 'label' => __( 'Countdowns', 'sportspress' ), + 'icon' => 'sp-icon-clock', + ), 'tournaments' => array( 'label' => __( 'Tournaments', 'sportspress' ), 'class' => 'SportsPress_Tournaments', diff --git a/modules/sportspress-countdowns.php b/modules/sportspress-countdowns.php new file mode 100644 index 00000000..dd3f5e89 --- /dev/null +++ b/modules/sportspress-countdowns.php @@ -0,0 +1,105 @@ +define_constants(); + + // Actions + add_action( 'sportspress_widgets', array( $this, 'include_widgets' ) ); + + // Filters + add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) ); + add_filter( 'sportspress_event_settings', array( $this, 'add_settings' ) ); + } + + /** + * Define constants. + */ + private function define_constants() { + if ( !defined( 'SP_COUNTDOWNS_VERSION' ) ) + define( 'SP_COUNTDOWNS_VERSION', '1.6.1' ); + + if ( !defined( 'SP_COUNTDOWNS_URL' ) ) + define( 'SP_COUNTDOWNS_URL', plugin_dir_url( __FILE__ ) ); + + if ( !defined( 'SP_COUNTDOWNS_DIR' ) ) + define( 'SP_COUNTDOWNS_DIR', plugin_dir_path( __FILE__ ) ); + } + + /** + * Add widgets. + * + * @return array + */ + public function include_widgets() { + include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-countdown.php' ); + } + + /** + * Add shortcodes. + * + * @return array + */ + public function add_shortcodes( $shortcodes ) { + $shortcodes['event'][] = 'countdown'; + return $shortcodes; + } + + /** + * Add settings. + * + * @return array + */ + public function add_settings( $settings ) { + $settings = array_merge( $settings, + array( + array( 'title' => __( 'Countdowns', 'sportspress' ), 'type' => 'title', 'id' => 'countdown_options' ), + ), + + apply_filters( 'sportspress_countdown_options', array( + array( + 'title' => __( 'Teams', 'sportspress' ), + 'desc' => __( 'Display logos', 'sportspress' ), + 'id' => 'sportspress_countdown_show_logos', + 'default' => 'no', + 'type' => 'checkbox', + ), + )), + + array( + array( 'type' => 'sectionend', 'id' => 'countdown_options' ), + ) + ); + return $settings; + } +} + +endif; + +if ( get_option( 'sportspress_load_countdowns_module', 'yes' ) == 'yes' ) { + new SportsPress_Countdowns(); +} diff --git a/sportspress.php b/sportspress.php index 7b2773de..eada084c 100644 --- a/sportspress.php +++ b/sportspress.php @@ -264,7 +264,6 @@ final class SportsPress { * Include core widgets. */ public function include_widgets() { - include_once( 'includes/widgets/class-sp-widget-countdown.php' ); include_once( 'includes/widgets/class-sp-widget-staff.php' ); do_action( 'sportspress_widgets' ); diff --git a/templates/countdown.php b/templates/countdown.php index 3988f363..2a91ef88 100644 --- a/templates/countdown.php +++ b/templates/countdown.php @@ -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 = '' . $ ?>
-

+

+ ID, 'sp_team' ) ); + $i = 0; + + foreach ( $teams as $team ) { + $i++; + if ( has_post_thumbnail ( $team ) ) { + if ( $link_teams ) { + echo ''; + } else { + echo get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $i % 2 ? 'odd' : 'even' ) ) ); + } + } + } + } + ?> + +

ID, 'sp_venue' );