Add League Table widget and display future events
This commit is contained in:
@@ -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)))) . '">« ' . $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)))) . '">« ' . $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"> </td>';
|
||||
}
|
||||
@@ -88,7 +88,7 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) {
|
||||
$calendar_output .= "\n\t\t".'<td class="pad"> </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)) . ' »</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)) . ' »</a></td>';
|
||||
} else {
|
||||
$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad"> </td>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user