Add event result filters
This commit is contained in:
@@ -160,7 +160,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
||||
$team_results = implode( ' | ', $team_results );
|
||||
endif;
|
||||
|
||||
echo '<a class="sp-result sp-tip" tabindex="10" title="' . $team_results . '" data-team="' . $team_id . '" href="#">' . ( $team_result == '' ? '-' : $team_result ) . '</a>';
|
||||
echo '<a class="sp-result sp-tip" tabindex="10" title="' . $team_results . '" data-team="' . $team_id . '" href="#">' . ( $team_result == '' ? '-' : apply_filters( 'sportspress_event_team_result_admin', $team_result, $post_id, $team_id ) ) . '</a>';
|
||||
echo '<input type="text" tabindex="10" class="sp-edit-result hidden small-text" data-team="' . $team_id . '" data-key="' . $main_result . '" value="' . $team_result . '"> ';
|
||||
echo $team->post_title;
|
||||
echo '<br>';
|
||||
|
||||
@@ -146,6 +146,7 @@ class SP_Meta_Box_Calendar_Data {
|
||||
endif;
|
||||
|
||||
if ( $team_result != null ):
|
||||
$team_result = apply_filters( 'sportspress_calendar_team_result_admin', $team_result, $event->ID, $team );
|
||||
$main_results[] = $team_result;
|
||||
unset( $team_results['outcome'] );
|
||||
$team_results = implode( ' | ', $team_results );
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$primary_result = get_option( 'sportspress_primary_result', null );
|
||||
|
||||
$defaults = array(
|
||||
'id' => null,
|
||||
'title' => false,
|
||||
@@ -82,12 +80,12 @@ if ( $title )
|
||||
foreach ( $data as $event ):
|
||||
if ( isset( $limit ) && $i >= $limit ) continue;
|
||||
|
||||
$permalink = get_post_permalink( $event, false, true );
|
||||
$results = get_post_meta( $event->ID, 'sp_results', true );
|
||||
|
||||
$teams = array_unique( get_post_meta( $event->ID, 'sp_team' ) );
|
||||
$teams = array_filter( $teams, 'sp_filter_positive' );
|
||||
$logos = array();
|
||||
$main_results = array();
|
||||
|
||||
$j = 0;
|
||||
foreach( $teams as $team ):
|
||||
@@ -100,28 +98,17 @@ if ( $title )
|
||||
endif;
|
||||
$logos[] = $logo;
|
||||
endif;
|
||||
$team_results = sp_array_value( $results, $team, null );
|
||||
|
||||
if ( $primary_result ):
|
||||
$team_result = sp_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;
|
||||
if ( $team_result != null )
|
||||
$main_results[] = $team_result;
|
||||
|
||||
endforeach;
|
||||
?>
|
||||
<tr class="sp-row sp-post<?php echo ( $i % 2 == 0 ? ' alternate' : '' ); ?>">
|
||||
<td>
|
||||
<?php echo implode( $logos, ' ' ); ?>
|
||||
<time class="sp-event-date" datetime="<?php echo $event->post_date; ?>"><?php echo get_the_time( get_option( 'date_format' ), $event ); ?></time>
|
||||
<h5 class="sp-event-results"><span class="sp-result"><?php echo implode( '</span>-<span class="sp-result">', sp_get_main_results_or_time( $event ) ); ?></span></h5>
|
||||
<time class="sp-event-date" datetime="<?php echo $event->post_date; ?>">
|
||||
<?php echo sp_add_link( get_the_time( get_option( 'date_format' ), $event ), $permalink, $link_events ); ?>
|
||||
</time>
|
||||
<h5 class="sp-event-results">
|
||||
<?php echo sp_add_link( '<span class="sp-result">' . implode( '</span>-<span class="sp-result">', apply_filters( 'sportspress_event_blocks_team_result_or_time', sp_get_main_results_or_time( $event ), $event->ID ) ), $permalink, $link_events . '</span>' ); ?>
|
||||
</h5>
|
||||
<?php if ( $show_league ): $leagues = get_the_terms( $event, 'sp_league' ); if ( $leagues ): $league = array_shift( $leagues ); ?>
|
||||
<div class="sp-event-league"><?php echo $league->name; ?></div>
|
||||
<?php endif; endif; ?>
|
||||
@@ -132,11 +119,7 @@ if ( $title )
|
||||
<div class="sp-event-venue"><?php echo $venue->name; ?></div>
|
||||
<?php endif; endif; ?>
|
||||
<h4 class="sp-event-title">
|
||||
<?php if ( $link_events ): ?>
|
||||
<a href="<?php echo get_post_permalink( $event, false, true ); ?>"><?php echo $event->post_title; ?></a>
|
||||
<?php else: ?>
|
||||
<?php echo $event->post_title; ?>
|
||||
<?php endif; ?>
|
||||
<?php echo sp_add_link( $event->post_title, $permalink, $link_events ); ?>
|
||||
</h4>
|
||||
|
||||
</td>
|
||||
|
||||
@@ -155,7 +155,7 @@ endif;
|
||||
$teams = get_post_meta( $event->ID, 'sp_team' );
|
||||
$video = get_post_meta( $event->ID, 'sp_video', true );
|
||||
|
||||
$main_results = sp_get_main_results( $event );
|
||||
$main_results = apply_filters( 'sportspress_event_list_main_results', sp_get_main_results( $event ), $event->ID );
|
||||
|
||||
$teams_output = '';
|
||||
$teams_array = array();
|
||||
|
||||
@@ -48,10 +48,12 @@ if ( $teams ):
|
||||
|
||||
// Add result
|
||||
if ( $show_results ) {
|
||||
$team_result = array_shift( $results );
|
||||
$team_result = apply_filters( 'sportspress_event_logos_team_result', $team_result, $id, $team );
|
||||
if ( $alt ) {
|
||||
$logo = '<strong class="sp-team-result">' . array_shift( $results ) . '</strong> ' . $logo;
|
||||
$logo = '<strong class="sp-team-result">' . $team_result . '</strong> ' . $logo;
|
||||
} else {
|
||||
$logo .= ' <strong class="sp-team-result">' . array_shift( $results ) . '</strong>';
|
||||
$logo .= ' <strong class="sp-team-result">' . $team_result . '</strong>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,11 +131,13 @@ if ( is_array( $teams ) ):
|
||||
$allowed_labels[ $label->post_name ] = $label->post_title;
|
||||
}
|
||||
|
||||
$allowed_labels = apply_filters( 'sportspress_event_performance_allowed_labels', $allowed_labels, $position_index );
|
||||
|
||||
$sublabels = array_intersect_key( $sublabels, $allowed_labels );
|
||||
}
|
||||
|
||||
if ( sizeof( $subdata ) ) {
|
||||
$subdata = apply_filters( 'sportspress_event_performance_split_team_split_position_subdata', $subdata, $data );
|
||||
$subdata = apply_filters( 'sportspress_event_performance_split_team_split_position_subdata', $subdata, $data, $position_index );
|
||||
|
||||
sp_get_template( 'event-performance-table.php', array(
|
||||
'position' => sp_get_position_caption( $position->term_id ),
|
||||
@@ -209,6 +211,8 @@ if ( is_array( $teams ) ):
|
||||
$subdata[ $player_id ] = $data[ $player_id ];
|
||||
}
|
||||
}
|
||||
|
||||
$subdata = apply_filters( 'sportspress_event_performance_split_position_subdata', $subdata, $data, $position_index );
|
||||
|
||||
if ( sizeof( $subdata ) ) {
|
||||
sp_get_template( 'event-performance-table-combined.php', array(
|
||||
|
||||
Reference in New Issue
Block a user