Add venue column to event list and prompt to select details if new calendar
This commit is contained in:
@@ -43,14 +43,14 @@ class SP_Admin_Menus {
|
|||||||
global $typenow;
|
global $typenow;
|
||||||
if ( in_array( $typenow, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_performance', 'sp_metric' ) ) )
|
if ( in_array( $typenow, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_performance', 'sp_metric' ) ) )
|
||||||
sportspress_highlight_admin_menu();
|
sportspress_highlight_admin_menu();
|
||||||
|
elseif ( $typenow == 'sp_calendar' )
|
||||||
|
sportspress_highlight_admin_menu( 'edit.php?post_type=sp_event', 'edit.php?post_type=sp_calendar' );
|
||||||
elseif ( $typenow == 'sp_table' )
|
elseif ( $typenow == 'sp_table' )
|
||||||
sportspress_highlight_admin_menu( 'edit.php?post_type=sp_team', 'edit.php?post_type=sp_table' );
|
sportspress_highlight_admin_menu( 'edit.php?post_type=sp_team', 'edit.php?post_type=sp_table' );
|
||||||
elseif ( $typenow == 'sp_list' )
|
elseif ( $typenow == 'sp_list' )
|
||||||
sportspress_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_list' );
|
sportspress_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_list' );
|
||||||
elseif ( $typenow == 'sp_staff' )
|
|
||||||
sportspress_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_staff' );
|
|
||||||
elseif ( $typenow == 'sp_directory' )
|
elseif ( $typenow == 'sp_directory' )
|
||||||
sportspress_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_directory' );
|
sportspress_highlight_admin_menu( 'edit.php?post_type=sp_staff', 'edit.php?post_type=sp_directory' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class SP_Admin_Meta_Boxes {
|
|||||||
add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'SP_Meta_Box_List_Shortcode::output', 'sp_list', 'side', 'default' );
|
add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'SP_Meta_Box_List_Shortcode::output', 'sp_list', 'side', 'default' );
|
||||||
add_meta_box( 'sp_formatdiv', __( 'Layout', 'sportspress' ), 'SP_Meta_Box_List_Format::output', 'sp_list', 'side', 'default' );
|
add_meta_box( 'sp_formatdiv', __( 'Layout', 'sportspress' ), 'SP_Meta_Box_List_Format::output', 'sp_list', 'side', 'default' );
|
||||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_List_Details::output', 'sp_list', 'side', 'default' );
|
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_List_Details::output', 'sp_list', 'side', 'default' );
|
||||||
add_meta_box( 'sp_datadiv', __( 'Player List', 'sportspress' ), 'SP_Meta_Box_List_Data::output', 'sp_list', 'normal', 'default' );
|
add_meta_box( 'sp_datadiv', __( 'Player List', 'sportspress' ), 'SP_Meta_Box_List_Data::output', 'sp_list', 'normal', 'high' );
|
||||||
add_meta_box( 'sp_descriptiondiv', __( 'Description', 'sportspress' ), 'SP_Meta_Box_List_Description::output', 'sp_list', 'normal', 'high' );
|
add_meta_box( 'sp_descriptiondiv', __( 'Description', 'sportspress' ), 'SP_Meta_Box_List_Description::output', 'sp_list', 'normal', 'high' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -402,6 +402,7 @@ class SP_Post_types {
|
|||||||
'has_archive' => false,
|
'has_archive' => false,
|
||||||
'show_in_nav_menus' => true,
|
'show_in_nav_menus' => true,
|
||||||
'show_in_menu' => 'edit.php?post_type=sp_event',
|
'show_in_menu' => 'edit.php?post_type=sp_event',
|
||||||
|
'show_in_admin_bar' => true,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -462,6 +463,7 @@ class SP_Post_types {
|
|||||||
'has_archive' => false,
|
'has_archive' => false,
|
||||||
'show_in_nav_menus' => true,
|
'show_in_nav_menus' => true,
|
||||||
'show_in_menu' => 'edit.php?post_type=sp_team',
|
'show_in_menu' => 'edit.php?post_type=sp_team',
|
||||||
|
'show_in_admin_bar' => true,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -522,6 +524,7 @@ class SP_Post_types {
|
|||||||
'has_archive' => false,
|
'has_archive' => false,
|
||||||
'show_in_nav_menus' => true,
|
'show_in_nav_menus' => true,
|
||||||
'show_in_menu' => 'edit.php?post_type=sp_player',
|
'show_in_menu' => 'edit.php?post_type=sp_player',
|
||||||
|
'show_in_admin_bar' => true,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -889,6 +889,12 @@ if ( !function_exists( 'sp_edit_calendar_table' ) ) {
|
|||||||
<?php _e( 'Time', 'sportspress' ); ?>
|
<?php _e( 'Time', 'sportspress' ); ?>
|
||||||
</label>
|
</label>
|
||||||
</th>
|
</th>
|
||||||
|
<th class="column-venue">
|
||||||
|
<label for="sp_columns_venue">
|
||||||
|
<input type="checkbox" name="sp_columns[]" value="venue" id="sp_columns_venue" <?php checked( ! is_array( $usecolumns ) || in_array( 'venue', $usecolumns ) ); ?>>
|
||||||
|
<?php _e( 'Venue', 'sportspress' ); ?>
|
||||||
|
</label>
|
||||||
|
</th>
|
||||||
<th class="column-article">
|
<th class="column-article">
|
||||||
<label for="sp_columns_article">
|
<label for="sp_columns_article">
|
||||||
<input type="checkbox" name="sp_columns[]" value="article" id="sp_columns_article" <?php checked( ! is_array( $usecolumns ) || in_array( 'article', $usecolumns ) ); ?>>
|
<input type="checkbox" name="sp_columns[]" value="article" id="sp_columns_article" <?php checked( ! is_array( $usecolumns ) || in_array( 'article', $usecolumns ) ); ?>>
|
||||||
@@ -941,6 +947,7 @@ if ( !function_exists( 'sp_edit_calendar_table' ) ) {
|
|||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo get_post_time( get_option( 'time_format' ), false, $event ); ?></td>
|
<td><?php echo get_post_time( get_option( 'time_format' ), false, $event ); ?></td>
|
||||||
|
<td><?php the_terms( $event->ID, 'sp_venue' ); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?php echo get_edit_post_link( $event->ID ); ?>#sp_articlediv">
|
<a href="<?php echo get_edit_post_link( $event->ID ); ?>#sp_articlediv">
|
||||||
<?php if ( $video ): ?>
|
<?php if ( $video ): ?>
|
||||||
@@ -966,7 +973,7 @@ if ( !function_exists( 'sp_edit_calendar_table' ) ) {
|
|||||||
else:
|
else:
|
||||||
?>
|
?>
|
||||||
<tr class="sp-row alternate">
|
<tr class="sp-row alternate">
|
||||||
<td colspan="4">
|
<td colspan="6">
|
||||||
<?php printf( __( 'Select %s', 'sportspress' ), __( 'Details', 'sportspress' ) ); ?>
|
<?php printf( __( 'Select %s', 'sportspress' ), __( 'Details', 'sportspress' ) ); ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -1074,27 +1081,37 @@ if ( !function_exists( 'sp_edit_player_list_table' ) ) {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
$i = 0;
|
if ( is_array( $data ) && sizeof( $data ) > 0 ):
|
||||||
foreach ( $data as $player_id => $player_stats ):
|
$i = 0;
|
||||||
if ( !$player_id ) continue;
|
foreach ( $data as $player_id => $player_stats ):
|
||||||
$div = get_term( $player_id, 'sp_season' );
|
if ( !$player_id ) continue;
|
||||||
$number = get_post_meta( $player_id, 'sp_number', true );
|
$div = get_term( $player_id, 'sp_season' );
|
||||||
?>
|
$number = get_post_meta( $player_id, 'sp_number', true );
|
||||||
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
?>
|
||||||
<td><?php echo ( $number ? $number : ' ' ); ?></td>
|
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
||||||
<td>
|
<td><?php echo ( $number ? $number : ' ' ); ?></td>
|
||||||
<?php echo get_the_title( $player_id ); ?>
|
<td>
|
||||||
</td>
|
<?php echo get_the_title( $player_id ); ?>
|
||||||
<?php foreach( $columns as $column => $label ):
|
</td>
|
||||||
$value = sportspress_array_value( $player_stats, $column, '' );
|
<?php foreach( $columns as $column => $label ):
|
||||||
$placeholder = sportspress_array_value( sportspress_array_value( $placeholders, $player_id, array() ), $column, 0 );
|
$value = sportspress_array_value( $player_stats, $column, '' );
|
||||||
?>
|
$placeholder = sportspress_array_value( sportspress_array_value( $placeholders, $player_id, array() ), $column, 0 );
|
||||||
<td><input type="text" name="sp_players[<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="<?php echo $placeholder; ?>" /></td>
|
?>
|
||||||
<?php endforeach; ?>
|
<td><input type="text" name="sp_players[<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="<?php echo $placeholder; ?>" /></td>
|
||||||
</tr>
|
<?php endforeach; ?>
|
||||||
<?php
|
</tr>
|
||||||
$i++;
|
<?php
|
||||||
endforeach;
|
$i++;
|
||||||
|
endforeach;
|
||||||
|
else:
|
||||||
|
?>
|
||||||
|
<tr class="sp-row alternate">
|
||||||
|
<td colspan="<?php $colspan = sizeof( $columns ) + 1; echo $colspan; ?>">
|
||||||
|
<?php printf( __( 'Select %s', 'sportspress' ), __( 'Players', 'sportspress' ) ); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -1607,6 +1624,7 @@ if ( !function_exists( 'sp_event_players_sub_filter' ) ) {
|
|||||||
|
|
||||||
if ( !function_exists( 'sp_get_calendar_data' ) ) {
|
if ( !function_exists( 'sp_get_calendar_data' ) ) {
|
||||||
function sp_get_calendar_data( $post_id = null, $admin = false ) {
|
function sp_get_calendar_data( $post_id = null, $admin = false ) {
|
||||||
|
global $pagenow;
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_type' => 'sp_event',
|
'post_type' => 'sp_event',
|
||||||
@@ -1620,7 +1638,7 @@ if ( !function_exists( 'sp_get_calendar_data' ) ) {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( $post_id ):
|
if ( $pagenow != 'post-new.php' && $post_id ):
|
||||||
$leagues = get_the_terms( $post_id, 'sp_league' );
|
$leagues = get_the_terms( $post_id, 'sp_league' );
|
||||||
$seasons = get_the_terms( $post_id, 'sp_season' );
|
$seasons = get_the_terms( $post_id, 'sp_season' );
|
||||||
$venues = get_the_terms( $post_id, 'sp_venue' );
|
$venues = get_the_terms( $post_id, 'sp_venue' );
|
||||||
@@ -1671,12 +1689,13 @@ if ( !function_exists( 'sp_get_calendar_data' ) ) {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
$events = get_posts( $args );
|
||||||
else:
|
else:
|
||||||
$usecolumns = null;
|
$usecolumns = null;
|
||||||
|
$events = null;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$events = get_posts( $args );
|
|
||||||
|
|
||||||
if ( $admin ):
|
if ( $admin ):
|
||||||
return array( $events, $usecolumns );
|
return array( $events, $usecolumns );
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -10,12 +10,13 @@ class SP_Widget_Event_List extends WP_Widget {
|
|||||||
extract($args);
|
extract($args);
|
||||||
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
|
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
|
||||||
$id = empty($instance['id']) ? null : $instance['id'];
|
$id = empty($instance['id']) ? null : $instance['id'];
|
||||||
|
$number = empty($instance['number']) ? null : $instance['number'];
|
||||||
$columns = empty($instance['columns']) ? null : $instance['columns'];
|
$columns = empty($instance['columns']) ? null : $instance['columns'];
|
||||||
$show_all_events_link = empty($instance['show_all_events_link']) ? false : $instance['show_all_events_link'];
|
$show_all_events_link = empty($instance['show_all_events_link']) ? false : $instance['show_all_events_link'];
|
||||||
echo $before_widget;
|
echo $before_widget;
|
||||||
if ( $title )
|
if ( $title )
|
||||||
echo $before_title . $title . $after_title;
|
echo $before_title . $title . $after_title;
|
||||||
sp_get_template( 'event-list.php', array( 'id' => $id, 'columns' => $columns, 'show_all_events_link' => $show_all_events_link ) );
|
sp_get_template( 'event-list.php', array( 'id' => $id, 'number' => $number, 'columns' => $columns, 'show_all_events_link' => $show_all_events_link ) );
|
||||||
echo $after_widget;
|
echo $after_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ class SP_Widget_Event_List extends WP_Widget {
|
|||||||
$instance = $old_instance;
|
$instance = $old_instance;
|
||||||
$instance['title'] = strip_tags($new_instance['title']);
|
$instance['title'] = strip_tags($new_instance['title']);
|
||||||
$instance['id'] = intval($new_instance['id']);
|
$instance['id'] = intval($new_instance['id']);
|
||||||
|
$instance['number'] = intval($new_instance['number']);
|
||||||
$instance['columns'] = (array)$new_instance['columns'];
|
$instance['columns'] = (array)$new_instance['columns'];
|
||||||
$instance['show_all_events_link'] = $new_instance['show_all_events_link'];
|
$instance['show_all_events_link'] = $new_instance['show_all_events_link'];
|
||||||
|
|
||||||
@@ -30,9 +32,10 @@ class SP_Widget_Event_List extends WP_Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function form( $instance ) {
|
function form( $instance ) {
|
||||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'columns' => null, 'show_all_events_link' => true ) );
|
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'number' => 5, 'columns' => null, 'show_all_events_link' => true ) );
|
||||||
$title = strip_tags($instance['title']);
|
$title = strip_tags($instance['title']);
|
||||||
$id = intval($instance['id']);
|
$id = intval($instance['id']);
|
||||||
|
$number = intval($instance['number']);
|
||||||
$columns = $instance['columns'];
|
$columns = $instance['columns'];
|
||||||
$show_all_events_link = $instance['show_all_events_link'];
|
$show_all_events_link = $instance['show_all_events_link'];
|
||||||
?>
|
?>
|
||||||
@@ -56,6 +59,10 @@ class SP_Widget_Event_List extends WP_Widget {
|
|||||||
?>
|
?>
|
||||||
</p>
|
</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>
|
||||||
|
|
||||||
|
|
||||||
<p class="sp-prefs">
|
<p class="sp-prefs">
|
||||||
<?php _e( 'Columns:', 'sportspress' ); ?><br>
|
<?php _e( 'Columns:', 'sportspress' ); ?><br>
|
||||||
<?php
|
<?php
|
||||||
@@ -63,6 +70,7 @@ class SP_Widget_Event_List extends WP_Widget {
|
|||||||
'event' => __( 'Event', 'sportspress' ),
|
'event' => __( 'Event', 'sportspress' ),
|
||||||
'teams' => __( 'Teams', 'sportspress' ),
|
'teams' => __( 'Teams', 'sportspress' ),
|
||||||
'time' => __( 'Time', 'sportspress' ),
|
'time' => __( 'Time', 'sportspress' ),
|
||||||
|
'venue' => __( 'Venue', 'sportspress' ),
|
||||||
'article' => __( 'Article', 'sportspress' ),
|
'article' => __( 'Article', 'sportspress' ),
|
||||||
);
|
);
|
||||||
$field_name = $this->get_field_name('columns') . '[]';
|
$field_name = $this->get_field_name('columns') . '[]';
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,121 +1,140 @@
|
|||||||
<?php
|
<?php
|
||||||
global $sportspress_options;
|
global $sportspress_options;
|
||||||
$main_result = sportspress_array_value( $sportspress_options, 'main_result', null );
|
$primary_result = sportspress_array_value( $sportspress_options, 'sportspress_primary_result', null );
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
|
'number' => -1,
|
||||||
'show_all_events_link' => false,
|
'show_all_events_link' => false,
|
||||||
);
|
);
|
||||||
|
|
||||||
extract( $defaults, EXTR_SKIP );
|
extract( $defaults, EXTR_SKIP );
|
||||||
|
?>
|
||||||
|
<div class="sp-table-wrapper">
|
||||||
|
<table class="sp-event-list sp-data-table sp-responsive-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<?php
|
||||||
|
list( $data, $usecolumns ) = sportspress_get_calendar_data( $id, true );
|
||||||
|
|
||||||
$output = '<div class="sp-table-wrapper">' .
|
if ( isset( $columns ) )
|
||||||
'<table class="sp-event-list sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
|
$usecolumns = $columns;
|
||||||
|
|
||||||
list( $data, $usecolumns ) = sportspress_get_calendar_data( $id, true );
|
echo '<th class="data-date">' . SP()->text->string('Date', 'event') . '</th>';
|
||||||
|
|
||||||
if ( isset( $columns ) )
|
if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
|
||||||
$usecolumns = $columns;
|
echo '<th class="data-event">' . SP()->text->string('Event', 'event') . '</th>';
|
||||||
|
|
||||||
$output .= '<th class="data-date">' . SP()->text->string('Date', 'event') . '</th>';
|
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) )
|
||||||
|
echo '<th class="data-teams">' . SP()->text->string('Teams', 'event') . '</th>';
|
||||||
|
|
||||||
if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
|
if ( $usecolumns == null || in_array( 'time', $usecolumns ) )
|
||||||
$output .= '<th class="data-event">' . SP()->text->string('Event', 'event') . '</th>';
|
echo '<th class="data-time">' . SP()->text->string('Time', 'event') . '</th>';
|
||||||
|
|
||||||
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) )
|
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) )
|
||||||
$output .= '<th class="data-teams">' . SP()->text->string('Teams', 'event') . '</th>';
|
echo '<th class="data-venue">' . SP()->text->string('Venue', 'event') . '</th>';
|
||||||
|
|
||||||
if ( $usecolumns == null || in_array( 'time', $usecolumns ) )
|
if ( $usecolumns == null || in_array( 'article', $usecolumns ) )
|
||||||
$output .= '<th class="data-time">' . SP()->text->string('Time', 'event') . '</th>';
|
echo '<th class="data-article">' . SP()->text->string('Article', 'event') . '</th>';
|
||||||
|
?>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
if ( $usecolumns == null || in_array( 'article', $usecolumns ) )
|
if ( is_int( $number ) && $number > 0 )
|
||||||
$output .= '<th class="data-article">' . SP()->text->string('Article', 'event') . '</th>';
|
$limit = $number;
|
||||||
|
|
||||||
$output .= '</tr>' . '</thead>' . '<tbody>';
|
foreach ( $data as $event ):
|
||||||
|
if ( isset( $limit ) && $i >= $limit ) continue;
|
||||||
|
|
||||||
$i = 0;
|
$teams = get_post_meta( $event->ID, 'sp_team' );
|
||||||
foreach ( $data as $event ):
|
$results = get_post_meta( $event->ID, 'sp_results', true );
|
||||||
$teams = get_post_meta( $event->ID, 'sp_team' );
|
$video = get_post_meta( $event->ID, 'sp_video', true );
|
||||||
$results = get_post_meta( $event->ID, 'sp_results', true );
|
|
||||||
$video = get_post_meta( $event->ID, 'sp_video', true );
|
|
||||||
|
|
||||||
$output .= '<tr class="sp-row sp-post' . ( $i % 2 == 0 ? ' alternate' : '' ) . '">';
|
echo '<tr class="sp-row sp-post' . ( $i % 2 == 0 ? ' alternate' : '' ) . '">';
|
||||||
|
|
||||||
$output .= '<td class="data-date">' . get_post_time( get_option( 'date_format' ), false, $event ) . '</td>';
|
echo '<td class="data-date">' . get_post_time( get_option( 'date_format' ), false, $event ) . '</td>';
|
||||||
|
|
||||||
if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
|
if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
|
||||||
$output .= '<td class="data-event">' . $event->post_title . '</td>';
|
echo '<td class="data-event">' . $event->post_title . '</td>';
|
||||||
|
|
||||||
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) ):
|
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) ):
|
||||||
$output .= '<td class="data-teams">';
|
echo '<td class="data-teams">';
|
||||||
|
|
||||||
$teams = get_post_meta( $event->ID, 'sp_team', false );
|
$teams = get_post_meta( $event->ID, 'sp_team', false );
|
||||||
if ( $teams ):
|
if ( $teams ):
|
||||||
foreach ( $teams as $team ):
|
foreach ( $teams as $team ):
|
||||||
$name = get_the_title( $team );
|
$name = get_the_title( $team );
|
||||||
if ( $name ):
|
if ( $name ):
|
||||||
$team_results = sportspress_array_value( $results, $team, null );
|
$team_results = sportspress_array_value( $results, $team, null );
|
||||||
|
|
||||||
if ( $main_result ):
|
if ( $primary_result ):
|
||||||
$team_result = sportspress_array_value( $team_results, $main_result, null );
|
$team_result = sportspress_array_value( $team_results, $primary_result, null );
|
||||||
|
else:
|
||||||
|
if ( is_array( $team_results ) ):
|
||||||
|
end( $team_results );
|
||||||
|
$team_result = prev( $team_results );
|
||||||
|
else:
|
||||||
|
$team_result = null;
|
||||||
|
endif;
|
||||||
|
endif;
|
||||||
|
|
||||||
|
echo $name;
|
||||||
|
|
||||||
|
if ( $team_result != null ):
|
||||||
|
echo ' (' . $team_result . ')';
|
||||||
|
endif;
|
||||||
|
|
||||||
|
echo '<br>';
|
||||||
|
endif;
|
||||||
|
endforeach;
|
||||||
else:
|
else:
|
||||||
if ( is_array( $team_results ) ):
|
echo '—';
|
||||||
end( $team_results );
|
|
||||||
$team_result = prev( $team_results );
|
|
||||||
else:
|
|
||||||
$team_result = null;
|
|
||||||
endif;
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$output .= $name;
|
echo '</td>';
|
||||||
|
endif;
|
||||||
|
|
||||||
if ( $team_result != null ):
|
if ( $usecolumns == null || in_array( 'time', $usecolumns ) )
|
||||||
$output .= ' (' . $team_result . ')';
|
echo '<td class="data-time">' . get_post_time( get_option( 'time_format' ), false, $event ) . '</td>';
|
||||||
endif;
|
|
||||||
|
|
||||||
$output .= '<br>';
|
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) ):
|
||||||
|
echo '<td class="data-venue">';
|
||||||
|
the_terms( $event->ID, 'sp_venue' );
|
||||||
|
echo '</td>';
|
||||||
|
endif;
|
||||||
|
|
||||||
|
if ( $usecolumns == null || in_array( 'article', $usecolumns ) ):
|
||||||
|
echo '<td class="data-article">
|
||||||
|
<a href="' . get_permalink( $event->ID ) . '">';
|
||||||
|
|
||||||
|
if ( $video ):
|
||||||
|
echo '<div class="dashicons dashicons-video-alt"></div>';
|
||||||
|
elseif ( has_post_thumbnail( $event->ID ) ):
|
||||||
|
echo '<div class="dashicons dashicons-camera"></div>';
|
||||||
endif;
|
endif;
|
||||||
endforeach;
|
if ( $event->post_content !== null ):
|
||||||
else:
|
if ( $event->post_status == 'publish' ):
|
||||||
$output .= '—';
|
echo SP()->text->string('Recap', 'event');
|
||||||
|
else:
|
||||||
|
echo SP()->text->string('Preview', 'event');
|
||||||
|
endif;
|
||||||
|
endif;
|
||||||
|
|
||||||
|
echo '</a>
|
||||||
|
</td>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$output .= '</td>';
|
echo '</tr>';
|
||||||
endif;
|
|
||||||
|
|
||||||
if ( $usecolumns == null || in_array( 'time', $usecolumns ) )
|
$i++;
|
||||||
$output .= '<td class="data-time">' . get_post_time( get_option( 'time_format' ), false, $event ) . '</td>';
|
endforeach;
|
||||||
|
?>
|
||||||
if ( $usecolumns == null || in_array( 'article', $usecolumns ) ):
|
</tbody>
|
||||||
$output .= '<td class="data-article">
|
</table>
|
||||||
<a href="' . get_permalink( $event->ID ) . '">';
|
<?php
|
||||||
|
if ( $id && $show_all_events_link )
|
||||||
if ( $video ):
|
echo '<a class="sp-calendar-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events', 'event') . '</a>';
|
||||||
$output .= '<div class="dashicons dashicons-video-alt"></div>';
|
?>
|
||||||
elseif ( has_post_thumbnail( $event->ID ) ):
|
</div>
|
||||||
$output .= '<div class="dashicons dashicons-camera"></div>';
|
|
||||||
endif;
|
|
||||||
if ( $event->post_content !== null ):
|
|
||||||
if ( $event->post_status == 'publish' ):
|
|
||||||
$output .= SP()->text->string('Recap', 'event');
|
|
||||||
else:
|
|
||||||
$output .= SP()->text->string('Preview', 'event');
|
|
||||||
endif;
|
|
||||||
endif;
|
|
||||||
|
|
||||||
$output .= '</a>
|
|
||||||
</td>';
|
|
||||||
endif;
|
|
||||||
|
|
||||||
$output .= '</tr>';
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
endforeach;
|
|
||||||
|
|
||||||
$output .= '</tbody>' . '</table>';
|
|
||||||
|
|
||||||
if ( $id && $show_all_events_link )
|
|
||||||
$output .= '<a class="sp-calendar-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events', 'event') . '</a>';
|
|
||||||
|
|
||||||
$output .= '</div>';
|
|
||||||
|
|
||||||
echo apply_filters( 'sportspress_event_list', $output );
|
|
||||||
Reference in New Issue
Block a user