/** * Show status widget */ public function status_widget() { ?> <ul class="sp_status_list"> <?php $count = wp_count_posts('sp_event'); $scheduled_count = isset($count->future) ? $count->future : 0; $published_count = isset($count->publish) ? $count->publish : 0; $next_event = sp_get_next_event(); if ($next_event) { $now = new DateTime(current_time('mysql', 0)); $date = new DateTime($next_event->post_date); $interval = date_diff($now, $date); ?> <li class="countdown" data-countdown="<?php echo str_replace('-', '/', $next_event->post_date); ?> "> <a href="<?php echo get_edit_post_link($next_event->ID); ?> "> <?php printf(__('<strong>%s</strong> until next event', 'sportspress'), $interval->days . ' ' . __('days', 'sportspress') . ' ' . sprintf('%02s:%02s:%02s', $interval->h, $interval->i, $interval->s)); ?> (<?php echo $next_event->post_title; ?> ) </a> </li> <?php } ?> <li class="events-scheduled"> <a href="<?php echo admin_url('edit.php?post_type=sp_event&post_status=future'); ?> "> <?php printf(_n('<strong>%s event</strong> scheduled', '<strong>%s events</strong> scheduled', $scheduled_count, 'sportspress'), $scheduled_count); ?> </a> </li> <li class="events-published"> <a href="<?php echo admin_url('edit.php?post_type=sp_event&post_status=publish'); ?> "> <?php printf(_n('<strong>%s event</strong> published', '<strong>%s events</strong> published', $published_count, 'sportspress'), $published_count); ?> </a> </li> </ul> <?php }
* @package SportsPress/Templates * @version 1.8.2 */ if (!defined('ABSPATH')) { exit; } // Exit if accessed directly $defaults = array('team' => null, '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)) { $post = get_post($id); } else { $args = array(); if (isset($team)) { $args = array(array('key' => 'sp_team', 'value' => $team)); } $post = sp_get_next_event($args); } extract($defaults, EXTR_SKIP); if (!isset($post)) { return; } $title = $post->post_title; if ($link_events) { $title = '<a href="' . get_post_permalink($post->ID, false, true) . '">' . $title . '</a>'; } ?> <div class="sp-template sp-template-countdown"> <div class="sp-countdown-wrapper"> <h3 class="event-name"> <?php if ($show_logos) {
function prosports_get_next_event($args = array()) { return sp_get_next_event($args); }