Add League Table widget and display future events

This commit is contained in:
Brian Miyaji
2014-02-02 05:23:43 +11:00
parent bd8561cdba
commit eca5c08d16
7 changed files with 85 additions and 27 deletions

View File

@@ -2,7 +2,7 @@
if ( !function_exists( 'sportspress_events_calendar' ) ) {
function sportspress_events_calendar( $initial = true ) {
global $wpdb, $m, $wp_locale, $posts;
global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
// Quick check. If we have no posts at all, abort!
if ( !$posts )
@@ -12,8 +12,8 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) {
$week_begins = intval(get_option('start_of_week'));
// Get year and month from query vars
$year = isset( $_GET['sp_year'] ) ? $_GET['sp_year'] : 0;
$monthnum = isset( $_GET['sp_month'] ) ? $_GET['sp_month'] : 0;
$year = isset( $_GET['sp_year'] ) ? $_GET['sp_year'] : $year;
$monthnum = isset( $_GET['sp_month'] ) ? $_GET['sp_month'] : $monthnum;
// Let's figure out when we are
if ( !empty($monthnum) && !empty($year) ) {
@@ -80,7 +80,7 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) {
<tr>';
if ( $previous ) {
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . add_query_arg( array( 'sp_year' => $previous->year, 'sp_month' => $previous->month ), get_permalink() ) . '" title="' . esc_attr( sprintf(__('View events for %1$s %2$s', 'sportspress'), $wp_locale->get_month($previous->month), date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)))) . '">&laquo; ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . add_query_arg( array( 'sp_year' => $previous->year, 'sp_month' => $previous->month ) ) . '" title="' . esc_attr( sprintf(__('%1$s %2$s', 'calendar caption', 'sportspress'), $wp_locale->get_month($previous->month), date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)))) . '">&laquo; ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
} else {
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
}
@@ -88,7 +88,7 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) {
$calendar_output .= "\n\t\t".'<td class="pad">&nbsp;</td>';
if ( $next ) {
$calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="' . add_query_arg( array( 'sp_year' => $next->year, 'sp_month' => $next->month ), get_permalink() ) . '" title="' . esc_attr( sprintf(__('View events for %1$s %2$s', 'sportspress'), $wp_locale->get_month($next->month), date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year))) ) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' &raquo;</a></td>';
$calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="' . add_query_arg( array( 'sp_year' => $next->year, 'sp_month' => $next->month ) ) . '" title="' . esc_attr( sprintf(__('%1$s %2$s', 'calendar caption', 'sportspress'), $wp_locale->get_month($next->month), date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year))) ) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' &raquo;</a></td>';
} else {
$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>';
}