Add settings for event lists
This commit is contained in:
@@ -128,37 +128,39 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|||||||
$results = get_post_meta( $post_id, 'sp_results', true );
|
$results = get_post_meta( $post_id, 'sp_results', true );
|
||||||
$main_result = get_option( 'sportspress_primary_result', null );
|
$main_result = get_option( 'sportspress_primary_result', null );
|
||||||
echo '<input type="hidden" name="sp_post_id" value="' . $post_id . '">';
|
echo '<input type="hidden" name="sp_post_id" value="' . $post_id . '">';
|
||||||
foreach( $teams as $team_id ):
|
echo '<div class="sp-results">';
|
||||||
if ( ! $team_id ) continue;
|
foreach( $teams as $team_id ):
|
||||||
$team = get_post( $team_id );
|
if ( ! $team_id ) continue;
|
||||||
|
$team = get_post( $team_id );
|
||||||
|
|
||||||
if ( $team ):
|
if ( $team ):
|
||||||
$team_results = sportspress_array_value( $results, $team_id, null );
|
$team_results = sportspress_array_value( $results, $team_id, null );
|
||||||
|
|
||||||
if ( $main_result ):
|
if ( $main_result ):
|
||||||
$team_result = sportspress_array_value( $team_results, $main_result, null );
|
$team_result = sportspress_array_value( $team_results, $main_result, null );
|
||||||
else:
|
|
||||||
if ( is_array( $team_results ) ):
|
|
||||||
end( $team_results );
|
|
||||||
$team_result = prev( $team_results );
|
|
||||||
$main_result = key( $team_results );
|
|
||||||
else:
|
else:
|
||||||
$team_result = null;
|
if ( is_array( $team_results ) ):
|
||||||
|
end( $team_results );
|
||||||
|
$team_result = prev( $team_results );
|
||||||
|
$main_result = key( $team_results );
|
||||||
|
else:
|
||||||
|
$team_result = null;
|
||||||
|
endif;
|
||||||
endif;
|
endif;
|
||||||
endif;
|
|
||||||
|
|
||||||
if ( is_array( $team_results ) ):
|
if ( is_array( $team_results ) ):
|
||||||
unset( $team_results['outcome'] );
|
unset( $team_results['outcome'] );
|
||||||
$team_results = implode( ' | ', $team_results );
|
$team_results = implode( ' | ', $team_results );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ( $team_result == null ) $team_result = '-';
|
if ( $team_result == null ) $team_result = '-';
|
||||||
echo '<a class="sp-result tips" title="' . $team_results . '" data-team="' . $team_id . '" href="#">' . $team_result . '</a>';
|
echo '<a class="sp-result tips" tabindex="10" title="' . $team_results . '" data-team="' . $team_id . '" href="#">' . $team_result . '</a>';
|
||||||
echo '<input type="text" class="sp-edit-result hidden small-text" data-team="' . $team_id . '" data-key="' . $main_result . '" value="' . $team_result . '"> ';
|
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 $team->post_title;
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
endif;
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
echo '</div>';
|
||||||
?>
|
?>
|
||||||
<div class="row-actions sp-row-actions"><span class="inline hide-if-no-js"><a href="#" class="sp-edit-results"><?php _e( 'Edit Results', 'sportspress' ); ?></a></span></div>
|
<div class="row-actions sp-row-actions"><span class="inline hide-if-no-js"><a href="#" class="sp-edit-results"><?php _e( 'Edit Results', 'sportspress' ); ?></a></span></div>
|
||||||
<p class="inline-edit-save sp-inline-edit-save hidden">
|
<p class="inline-edit-save sp-inline-edit-save hidden">
|
||||||
@@ -207,7 +209,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
'show_option_all' => __( 'Show all leagues', 'sportspress' ),
|
'show_option_all' => __( 'Show all competitions', 'sportspress' ),
|
||||||
'taxonomy' => 'sp_league',
|
'taxonomy' => 'sp_league',
|
||||||
'name' => 'sp_league',
|
'name' => 'sp_league',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
|
|||||||
@@ -174,6 +174,31 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|||||||
|
|
||||||
array( 'title' => __( 'Event List', 'sportspress' ), 'type' => 'title', 'id' => 'event_list_options' ),
|
array( 'title' => __( 'Event List', 'sportspress' ), 'type' => 'title', 'id' => 'event_list_options' ),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'title' => __( 'Title Format', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_event_list_title_format',
|
||||||
|
'default' => 'title',
|
||||||
|
'type' => 'select',
|
||||||
|
'options' => array(
|
||||||
|
'title' => __( 'Title', 'sportspress' ),
|
||||||
|
'teams' => __( 'Teams', 'sportspress' ),
|
||||||
|
'homeaway' => sprintf( '%s | %s', __( 'Home', 'sportspress' ), __( 'Away', 'sportspress' ) ),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'title' => __( 'Time/Results Format', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_event_list_time_format',
|
||||||
|
'default' => 'combined',
|
||||||
|
'type' => 'select',
|
||||||
|
'options' => array(
|
||||||
|
'combined' => __( 'Combined', 'sportspress' ),
|
||||||
|
'separate' => __( 'Separate', 'sportspress' ),
|
||||||
|
'time' => __( 'Time Only', 'sportspress' ),
|
||||||
|
'results' => __( 'Results Only', 'sportspress' ),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Pagination', 'sportspress' ),
|
'title' => __( 'Pagination', 'sportspress' ),
|
||||||
'desc' => __( 'Paginate', 'sportspress' ),
|
'desc' => __( 'Paginate', 'sportspress' ),
|
||||||
@@ -201,7 +226,7 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Details', 'sportspress' ),
|
'title' => __( 'Details', 'sportspress' ),
|
||||||
'desc' => __( 'Display league', 'sportspress' ),
|
'desc' => __( 'Display competition', 'sportspress' ),
|
||||||
'id' => 'sportspress_event_blocks_show_league',
|
'id' => 'sportspress_event_blocks_show_league',
|
||||||
'default' => 'no',
|
'default' => 'no',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
|
|||||||
Reference in New Issue
Block a user