Add match day field to events and calendars
This commit is contained in:
@@ -25,8 +25,10 @@ class SP_Meta_Box_Calendar_Details {
|
||||
$date = get_post_meta( $post->ID, 'sp_date', true );
|
||||
$date_from = get_post_meta( $post->ID, 'sp_date_from', true );
|
||||
$date_to = get_post_meta( $post->ID, 'sp_date_to', true );
|
||||
$day = get_post_meta( $post->ID, 'sp_day', true );
|
||||
$teams = get_post_meta( $post->ID, 'sp_team', false );
|
||||
$table_id = get_post_meta( $post->ID, 'sp_table', true );
|
||||
$orderby = get_post_meta( $post->ID, 'sp_orderby', true );
|
||||
$order = get_post_meta( $post->ID, 'sp_order', true );
|
||||
?>
|
||||
<div>
|
||||
@@ -62,6 +64,12 @@ class SP_Meta_Box_Calendar_Details {
|
||||
<input type="text" class="sp-datepicker-to" name="sp_date_to" value="<?php echo $date_to ? $date_to : date_i18n( 'Y-m-d' ); ?>" size="10">
|
||||
</p>
|
||||
</div>
|
||||
<div class="sp-event-day-field">
|
||||
<p><strong><?php _e( 'Match Day', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<input name="sp_day" type="text" class="medium-text" placeholder="<?php _e( 'All', 'sportspress' ); ?>" value="<?php echo esc_attr( $day ); ?>">
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
foreach ( $taxonomies as $taxonomy ) {
|
||||
sp_taxonomy_field( $taxonomy, $post, true );
|
||||
@@ -85,6 +93,13 @@ class SP_Meta_Box_Calendar_Details {
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<p><strong><?php _e( 'Sort by', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<select name="sp_orderby">
|
||||
<option value="date" <?php selected( 'date', $orderby ); ?>><?php _e( 'Date', 'sportspress' ); ?></option>
|
||||
<option value="day" <?php selected( 'day', $orderby ); ?>><?php _e( 'Match Day', 'sportspress' ); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
<p><strong><?php _e( 'Sort Order', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<select name="sp_order">
|
||||
@@ -105,7 +120,9 @@ class SP_Meta_Box_Calendar_Details {
|
||||
update_post_meta( $post_id, 'sp_date', sp_array_value( $_POST, 'sp_date', 0 ) );
|
||||
update_post_meta( $post_id, 'sp_date_from', sp_array_value( $_POST, 'sp_date_from', null ) );
|
||||
update_post_meta( $post_id, 'sp_date_to', sp_array_value( $_POST, 'sp_date_to', null ) );
|
||||
update_post_meta( $post_id, 'sp_order', sp_array_value( $_POST, 'sp_order', array() ) );
|
||||
update_post_meta( $post_id, 'sp_day', sp_array_value( $_POST, 'sp_day', null ) );
|
||||
update_post_meta( $post_id, 'sp_orderby', sp_array_value( $_POST, 'sp_orderby', null ) );
|
||||
update_post_meta( $post_id, 'sp_order', sp_array_value( $_POST, 'sp_order', null ) );
|
||||
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
|
||||
}
|
||||
}
|
||||
@@ -19,10 +19,17 @@ class SP_Meta_Box_Event_Details {
|
||||
* Output the metabox
|
||||
*/
|
||||
public static function output( $post ) {
|
||||
$day = get_post_meta( $post->ID, 'sp_day', true );
|
||||
$taxonomies = get_object_taxonomies( 'sp_event' );
|
||||
$minutes = get_post_meta( $post->ID, 'sp_minutes', true );
|
||||
?>
|
||||
<?php do_action( 'sportspress_event_details_meta_box', $post ); ?>
|
||||
<div class="sp-event-day-field">
|
||||
<p><strong><?php _e( 'Match Day', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<input name="sp_day" type="text" class="medium-text" placeholder="<?php _e( 'Default', 'sportspress' ); ?>" value="<?php echo esc_attr( $day ); ?>">
|
||||
</p>
|
||||
</div>
|
||||
<div class="sp-event-minutes-field">
|
||||
<p><strong><?php _e( 'Full Time', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
@@ -66,6 +73,7 @@ class SP_Meta_Box_Event_Details {
|
||||
* Save meta box data
|
||||
*/
|
||||
public static function save( $post_id, $post ) {
|
||||
update_post_meta( $post_id, 'sp_day', sp_array_value( $_POST, 'sp_day', null ) );
|
||||
update_post_meta( $post_id, 'sp_minutes', sp_array_value( $_POST, 'sp_minutes', get_option( 'sportspress_event_minutes', 90 ) ) );
|
||||
$venues = array_filter( sp_array_value( sp_array_value( $_POST, 'tax_input', array() ), 'sp_venue', array() ) );
|
||||
if ( empty( $venues ) ) {
|
||||
|
||||
@@ -554,6 +554,16 @@ class SP_AJAX {
|
||||
<input type="text" size="3" name="number" id="number" value="5">
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<?php _e( 'Sort by:', 'sportspress' ); ?>
|
||||
<select id="orderby" name="orderby">
|
||||
<option value="default"><?php _e( 'Default', 'sportspress' ); ?></option>
|
||||
<option value="date"><?php _e( 'Date', 'sportspress' ); ?></option>
|
||||
<option value="day"><?php _e( 'Match Day', 'sportspress' ); ?></option>
|
||||
</select>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<?php _e( 'Sort Order:', 'sportspress' ); ?>
|
||||
@@ -934,6 +944,7 @@ class SP_AJAX {
|
||||
args.status = $div.find('[name=status]').val();
|
||||
args.date = $div.find('[name=date]').val();
|
||||
args.number = $div.find('[name=number]').val();
|
||||
args.orderby = $div.find('[name=orderby]').val();
|
||||
args.order = $div.find('[name=order]').val();
|
||||
args.show_all_events_link = $div.find('[name=show_all_events_link]:checked').length;
|
||||
} else if ( 'league_table' == type ) {
|
||||
|
||||
@@ -22,12 +22,18 @@ class SP_Calendar extends SP_Custom_Post {
|
||||
/** @var string The events order. */
|
||||
public $order;
|
||||
|
||||
/** @var string The events orderby. */
|
||||
public $orderby;
|
||||
|
||||
/** @var string The date to range from. */
|
||||
public $from;
|
||||
|
||||
/** @var string The date to range to. */
|
||||
public $to;
|
||||
|
||||
/** @var string The match day. */
|
||||
public $day;
|
||||
|
||||
/** @var int The competition ID. */
|
||||
public $league;
|
||||
|
||||
@@ -63,6 +69,7 @@ class SP_Calendar extends SP_Custom_Post {
|
||||
|
||||
$this->status = $this->__get( 'status' );
|
||||
$this->date = $this->__get( 'date' );
|
||||
$this->orderby = $this->__get( 'orderby' );
|
||||
$this->order = $this->__get( 'order' );
|
||||
$this->number = $this->__get( 'number' );
|
||||
|
||||
@@ -75,12 +82,18 @@ class SP_Calendar extends SP_Custom_Post {
|
||||
if ( ! $this->order )
|
||||
$this->order = 'ASC';
|
||||
|
||||
if ( ! $this->orderby )
|
||||
$this->orderby = get_post_meta( $this->ID, 'sp_orderby', true );
|
||||
|
||||
if ( ! $this->from )
|
||||
$this->from = get_post_meta( $this->ID, 'sp_date_from', true );
|
||||
|
||||
if ( ! $this->to )
|
||||
$this->to = get_post_meta( $this->ID, 'sp_date_to', true );
|
||||
|
||||
if ( ! $this->day )
|
||||
$this->day = get_post_meta( $this->ID, 'sp_day', true );
|
||||
|
||||
if ( ! $this->number )
|
||||
$this->number = 500;
|
||||
}
|
||||
@@ -97,7 +110,7 @@ class SP_Calendar extends SP_Custom_Post {
|
||||
$args = array(
|
||||
'post_type' => 'sp_event',
|
||||
'posts_per_page' => $this->number,
|
||||
'orderby' => 'date',
|
||||
'orderby' => $this->orderby,
|
||||
'order' => $this->order,
|
||||
'post_status' => $this->status,
|
||||
'meta_query' => array(
|
||||
@@ -149,6 +162,18 @@ class SP_Calendar extends SP_Custom_Post {
|
||||
);
|
||||
endif;
|
||||
|
||||
if ( $this->day ):
|
||||
$args['meta_query'][] = array(
|
||||
'key' => 'sp_day',
|
||||
'value' => $this->day,
|
||||
);
|
||||
endif;
|
||||
|
||||
if ( 'day' == $this->orderby ):
|
||||
$args['orderby'] = 'meta_value_num';
|
||||
$args['meta_key'] = 'sp_day';
|
||||
endif;
|
||||
|
||||
if ( $pagenow != 'post-new.php' ):
|
||||
if ( $this->ID ):
|
||||
$leagues = get_the_terms( $this->ID, 'sp_league' );
|
||||
@@ -178,7 +203,6 @@ class SP_Calendar extends SP_Custom_Post {
|
||||
endforeach;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
if ( isset( $league_ids ) ) {
|
||||
$args['tax_query'][] = array(
|
||||
|
||||
@@ -21,6 +21,7 @@ class SP_Widget_Event_Blocks extends WP_Widget {
|
||||
$date = empty($instance['date']) ? 'default' : $instance['date'];
|
||||
$date_from = empty($instance['date_from']) ? 'default' : $instance['date_from'];
|
||||
$date_to = empty($instance['date_to']) ? 'default' : $instance['date_to'];
|
||||
$day = empty($instance['day']) ? 'default' : $instance['day'];
|
||||
$number = empty($instance['number']) ? null : $instance['number'];
|
||||
$order = empty($instance['order']) ? 'default' : $instance['order'];
|
||||
$show_all_events_link = empty($instance['show_all_events_link']) ? false : $instance['show_all_events_link'];
|
||||
@@ -34,7 +35,7 @@ class SP_Widget_Event_Blocks extends WP_Widget {
|
||||
// Action to hook into
|
||||
do_action( 'sportspress_before_widget_template', $args, $instance, 'event-blocks' );
|
||||
|
||||
sp_get_template( 'event-blocks.php', array( 'id' => $id, 'title' => $caption, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'number' => $number, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
|
||||
sp_get_template( 'event-blocks.php', array( 'id' => $id, 'title' => $caption, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'day' => $day, 'number' => $number, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
|
||||
|
||||
// Action to hook into
|
||||
do_action( 'sportspress_after_widget_template', $args, $instance, 'event-blocks' );
|
||||
@@ -52,6 +53,7 @@ class SP_Widget_Event_Blocks extends WP_Widget {
|
||||
$instance['date'] = $new_instance['date'];
|
||||
$instance['date_from'] = $new_instance['date_from'];
|
||||
$instance['date_to'] = $new_instance['date_to'];
|
||||
$instance['day'] = $new_instance['day'];
|
||||
$instance['number'] = intval($new_instance['number']);
|
||||
$instance['order'] = strip_tags($new_instance['order']);
|
||||
$instance['show_all_events_link'] = $new_instance['show_all_events_link'];
|
||||
@@ -63,7 +65,7 @@ class SP_Widget_Event_Blocks extends WP_Widget {
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'caption' => '', 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'number' => 5, 'order' => 'default', 'show_all_events_link' => true ) );
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'caption' => '', 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'day' => '', 'number' => 5, 'order' => 'default', 'show_all_events_link' => true ) );
|
||||
$title = strip_tags($instance['title']);
|
||||
$id = intval($instance['id']);
|
||||
$caption = strip_tags($instance['caption']);
|
||||
@@ -71,6 +73,7 @@ class SP_Widget_Event_Blocks extends WP_Widget {
|
||||
$date = $instance['date'];
|
||||
$date_from = $instance['date_from'];
|
||||
$date_to = $instance['date_to'];
|
||||
$day = $instance['day'];
|
||||
$number = intval($instance['number']);
|
||||
$order = strip_tags($instance['order']);
|
||||
$show_all_events_link = $instance['show_all_events_link'];
|
||||
@@ -134,6 +137,9 @@ class SP_Widget_Event_Blocks extends WP_Widget {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('day'); ?>"><?php _e( 'Match Day:', 'sportspress' ); ?></label>
|
||||
<input id="<?php echo $this->get_field_id('day'); ?>" name="<?php echo $this->get_field_name('day'); ?>" type="text" placeholder="<?php _e( 'All', 'sportspress' ); ?>" value="<?php echo esc_attr($day); ?>" size="10"></p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e( 'Number of events to show:', 'sportspress' ); ?></label>
|
||||
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo esc_attr($number); ?>" size="3"></p>
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ class SP_Widget_Event_Calendar extends WP_Widget {
|
||||
$date = empty($instance['date']) ? 'default' : $instance['date'];
|
||||
$date_from = empty($instance['date_from']) ? 'default' : $instance['date_from'];
|
||||
$date_to = empty($instance['date_to']) ? 'default' : $instance['date_to'];
|
||||
$day = empty($instance['day']) ? 'default' : $instance['day'];
|
||||
$show_all_events_link = empty($instance['show_all_events_link']) ? false : $instance['show_all_events_link'];
|
||||
|
||||
do_action( 'sportspress_before_widget', $args, $instance, 'event-calendar' );
|
||||
@@ -31,7 +32,7 @@ class SP_Widget_Event_Calendar extends WP_Widget {
|
||||
// Action to hook into
|
||||
do_action( 'sportspress_before_widget_template', $args, $instance, 'event-calendar' );
|
||||
|
||||
sp_get_template( 'event-calendar.php', array( 'id' => $id, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'caption_tag' => 'caption', 'show_all_events_link' => $show_all_events_link ) );
|
||||
sp_get_template( 'event-calendar.php', array( 'id' => $id, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'caption_tag' => 'caption', 'day' => $day, 'show_all_events_link' => $show_all_events_link ) );
|
||||
|
||||
// Action to hook into
|
||||
do_action( 'sportspress_after_widget_template', $args, $instance, 'event-calendar' );
|
||||
@@ -48,6 +49,7 @@ class SP_Widget_Event_Calendar extends WP_Widget {
|
||||
$instance['date'] = $new_instance['date'];
|
||||
$instance['date_from'] = $new_instance['date_from'];
|
||||
$instance['date_to'] = $new_instance['date_to'];
|
||||
$instance['day'] = $new_instance['day'];
|
||||
$instance['show_all_events_link'] = $new_instance['show_all_events_link'];
|
||||
|
||||
// Filter to hook into
|
||||
@@ -57,13 +59,14 @@ class SP_Widget_Event_Calendar extends WP_Widget {
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'show_all_events_link' => false ) );
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'day' => '', 'show_all_events_link' => false ) );
|
||||
$title = strip_tags($instance['title']);
|
||||
$id = intval($instance['id']);
|
||||
$status = $instance['status'];
|
||||
$date = $instance['date'];
|
||||
$date_from = $instance['date_from'];
|
||||
$date_to = $instance['date_to'];
|
||||
$day = $instance['day'];
|
||||
$show_all_events_link = $instance['show_all_events_link'];
|
||||
|
||||
// Action to hook into
|
||||
@@ -122,6 +125,9 @@ class SP_Widget_Event_Calendar extends WP_Widget {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('day'); ?>"><?php _e( 'Match Day:', 'sportspress' ); ?></label>
|
||||
<input id="<?php echo $this->get_field_id('day'); ?>" name="<?php echo $this->get_field_name('day'); ?>" type="text" placeholder="<?php _e( 'All', 'sportspress' ); ?>" value="<?php echo esc_attr($day); ?>" size="10"></p>
|
||||
|
||||
<p class="sp-event-calendar-show-all-toggle<?php if ( ! $id ): ?> hidden<?php endif; ?>"><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_events_link'); ?>" name="<?php echo $this->get_field_name('show_all_events_link'); ?>" value="1" <?php checked( $show_all_events_link, 1 ); ?>>
|
||||
<label for="<?php echo $this->get_field_id('show_all_events_link'); ?>"><?php _e( 'Display link to view all events', 'sportspress' ); ?></label></p>
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ class SP_Widget_Event_List extends WP_Widget {
|
||||
$date = empty($instance['date']) ? 'default' : $instance['date'];
|
||||
$date_from = empty($instance['date_from']) ? 'default' : $instance['date_from'];
|
||||
$date_to = empty($instance['date_to']) ? 'default' : $instance['date_to'];
|
||||
$day = empty($instance['day']) ? 'default' : $instance['day'];
|
||||
$number = empty($instance['number']) ? null : $instance['number'];
|
||||
$columns = empty($instance['columns']) ? null : $instance['columns'];
|
||||
$order = empty($instance['order']) ? 'default' : $instance['order'];
|
||||
@@ -35,7 +36,7 @@ class SP_Widget_Event_List extends WP_Widget {
|
||||
// Action to hook into
|
||||
do_action( 'sportspress_before_widget_template', $args, $instance, 'event-list' );
|
||||
|
||||
sp_get_template( 'event-list.php', array( 'id' => $id, 'title' => $caption, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'number' => $number, 'columns' => $columns, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
|
||||
sp_get_template( 'event-list.php', array( 'id' => $id, 'title' => $caption, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'day' => $day, 'number' => $number, 'columns' => $columns, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
|
||||
|
||||
// Action to hook into
|
||||
do_action( 'sportspress_after_widget_template', $args, $instance, 'event-list' );
|
||||
@@ -53,6 +54,7 @@ class SP_Widget_Event_List extends WP_Widget {
|
||||
$instance['date'] = $new_instance['date'];
|
||||
$instance['date_from'] = $new_instance['date_from'];
|
||||
$instance['date_to'] = $new_instance['date_to'];
|
||||
$instance['day'] = $new_instance['day'];
|
||||
$instance['number'] = intval($new_instance['number']);
|
||||
$instance['columns'] = (array)$new_instance['columns'];
|
||||
$instance['order'] = strip_tags($new_instance['order']);
|
||||
@@ -65,7 +67,7 @@ class SP_Widget_Event_List extends WP_Widget {
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'caption' => '', 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'number' => 5, 'columns' => null, 'order' => 'default', 'show_all_events_link' => true ) );
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'caption' => '', 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'day' => '', 'number' => 5, 'columns' => null, 'order' => 'default', 'show_all_events_link' => true ) );
|
||||
$title = strip_tags($instance['title']);
|
||||
$id = intval($instance['id']);
|
||||
$caption = strip_tags($instance['caption']);
|
||||
@@ -73,6 +75,7 @@ class SP_Widget_Event_List extends WP_Widget {
|
||||
$date = $instance['date'];
|
||||
$date_from = $instance['date_from'];
|
||||
$date_to = $instance['date_to'];
|
||||
$day = $instance['day'];
|
||||
$number = intval($instance['number']);
|
||||
$columns = $instance['columns'];
|
||||
$order = strip_tags($instance['order']);
|
||||
@@ -137,6 +140,9 @@ class SP_Widget_Event_List extends WP_Widget {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('day'); ?>"><?php _e( 'Match Day:', 'sportspress' ); ?></label>
|
||||
<input id="<?php echo $this->get_field_id('day'); ?>" name="<?php echo $this->get_field_name('day'); ?>" type="text" placeholder="<?php _e( 'All', 'sportspress' ); ?>" value="<?php echo esc_attr($day); ?>" size="10"></p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e( 'Number of events to show:', 'sportspress' ); ?></label>
|
||||
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo esc_attr($number); ?>" size="3"></p>
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ $defaults = array(
|
||||
'date' => 'default',
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'day' => 'default',
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'venue' => null,
|
||||
@@ -27,6 +28,7 @@ $defaults = array(
|
||||
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_event_blocks_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_event_blocks_rows', 5 ),
|
||||
'orderby' => 'default',
|
||||
'order' => 'default',
|
||||
'show_all_events_link' => false,
|
||||
'show_title' => get_option( 'sportspress_event_blocks_show_title', 'no' ) == 'yes' ? true : false,
|
||||
@@ -59,6 +61,10 @@ if ( $player )
|
||||
$calendar->player = $player;
|
||||
if ( $order != 'default' )
|
||||
$calendar->order = $order;
|
||||
if ( $orderby != 'default' )
|
||||
$calendar->orderby = $orderby;
|
||||
if ( $day != 'default' )
|
||||
$calendar->day = $day;
|
||||
$data = $calendar->data();
|
||||
|
||||
if ( $hide_if_empty && empty( $data ) ) return;
|
||||
@@ -109,6 +115,14 @@ if ( $title )
|
||||
endif;
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
if ( 'day' === $calendar->orderby ):
|
||||
$event_group = get_post_meta( $event->ID, 'sp_day', true );
|
||||
if ( ! isset( $group ) || $event_group !== $group ):
|
||||
$group = $event_group;
|
||||
echo '<tr><th><strong class="sp-event-group-name">', __( 'Match Day', 'sportspress' ), ' ', $group, '</strong></th></tr>';
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
<tr class="sp-row sp-post<?php echo ( $i % 2 == 0 ? ' alternate' : '' ); ?>">
|
||||
<td>
|
||||
|
||||
@@ -17,6 +17,7 @@ $defaults = array(
|
||||
'date' => 'default',
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'day' => 'default',
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'venue' => null,
|
||||
@@ -39,6 +40,8 @@ if ( $date_from != 'default' )
|
||||
$calendar->from = $date_from;
|
||||
if ( $date_to != 'default' )
|
||||
$calendar->to = $date_to;
|
||||
if ( $day != 'default' )
|
||||
$calendar->day = $day;
|
||||
if ( $league )
|
||||
$calendar->league = $league;
|
||||
if ( $season )
|
||||
|
||||
@@ -16,6 +16,7 @@ $defaults = array(
|
||||
'date' => 'default',
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'day' => 'default',
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'venue' => null,
|
||||
@@ -60,6 +61,8 @@ if ( $player )
|
||||
$calendar->player = $player;
|
||||
if ( $order != 'default' )
|
||||
$calendar->order = $order;
|
||||
if ( $day != 'default' )
|
||||
$calendar->day = $day;
|
||||
$data = $calendar->data();
|
||||
$usecolumns = $calendar->columns;
|
||||
$title_format = get_option( 'sportspress_event_list_title_format', 'title' );
|
||||
|
||||
Reference in New Issue
Block a user