diff --git a/admin/options/config.php b/admin/options/config.php
index aed263d6..f879c3c1 100644
--- a/admin/options/config.php
+++ b/admin/options/config.php
@@ -131,16 +131,18 @@
|
+ |
>
| post_title; ?> |
+ post_name; ?> |
- |
+ |
@@ -160,16 +162,18 @@
|
+ |
>
| post_title; ?> |
+ post_name; ?> |
- |
+ |
\ No newline at end of file
diff --git a/admin/post-types/column.php b/admin/post-types/column.php
index 16db69ed..3ff8b393 100644
--- a/admin/post-types/column.php
+++ b/admin/post-types/column.php
@@ -24,7 +24,8 @@ function sp_column_edit_columns() {
'cb' => '',
'title' => __( 'Label', 'sportspress' ),
'sp_equation' => __( 'Equation', 'sportspress' ),
- 'sp_order' => __( 'Sort Order', 'sportspress' )
+ 'sp_order' => __( 'Sort Order', 'sportspress' ),
+ 'sp_key' => __( 'Key', 'sportspress' )
);
return $columns;
}
diff --git a/admin/post-types/outcome.php b/admin/post-types/outcome.php
index 86fa9025..d7e7b97e 100644
--- a/admin/post-types/outcome.php
+++ b/admin/post-types/outcome.php
@@ -23,7 +23,8 @@ function sp_outcome_edit_columns() {
$columns = array(
'cb' => '',
'title' => __( 'Label', 'sportspress' ),
- 'sp_abbreviation' => __( 'Abbreviation', 'sportspress' )
+ 'sp_abbreviation' => __( 'Abbreviation', 'sportspress' ),
+ 'sp_key' => __( 'Key', 'sportspress' )
);
return $columns;
}
diff --git a/admin/post-types/result.php b/admin/post-types/result.php
index 6ca30668..dfd9fe8c 100644
--- a/admin/post-types/result.php
+++ b/admin/post-types/result.php
@@ -21,7 +21,8 @@ add_action( 'init', 'sp_result_cpt_init' );
function sp_result_edit_columns() {
$columns = array(
'cb' => '',
- 'title' => __( 'Label', 'sportspress' )
+ 'title' => __( 'Label', 'sportspress' ),
+ 'sp_key' => __( 'Key', 'sportspress' )
);
return $columns;
}
diff --git a/admin/post-types/statistic.php b/admin/post-types/statistic.php
index 73b0d573..05d8b777 100644
--- a/admin/post-types/statistic.php
+++ b/admin/post-types/statistic.php
@@ -24,6 +24,7 @@ function sp_statistic_edit_columns() {
'cb' => '',
'title' => __( 'Label', 'sportspress' ),
'sp_equation' => __( 'Equation', 'sportspress' ),
+ 'sp_key' => __( 'Key', 'sportspress' )
);
return $columns;
}
diff --git a/admin/post-types/team.php b/admin/post-types/team.php
index 459ab8f3..0be0108a 100644
--- a/admin/post-types/team.php
+++ b/admin/post-types/team.php
@@ -106,13 +106,13 @@ function sp_team_columns_meta( $post ) {
$events = get_posts( $args );
foreach( $events as $event ):
- $totals['eventsplayed']++;
$results = (array)get_post_meta( $event->ID, 'sp_results', true );
foreach ( $results as $team_id => $team_result ):
foreach ( $team_result as $key => $value ):
if ( $team_id == $post->ID ):
if ( $key == 'outcome' ):
if ( array_key_exists( $value, $totals ) ):
+ $totals['eventsplayed']++;
$totals[ $value ]++;
endif;
else:
diff --git a/sportspress-actions.php b/sportspress-actions.php
index 85fa5501..69f4f825 100644
--- a/sportspress-actions.php
+++ b/sportspress-actions.php
@@ -51,8 +51,21 @@ function sp_manage_posts_custom_column( $column, $post_id ) {
echo get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—';
break;
case 'sp_team':
- $result = get_post_meta( $post_id, 'sp_result', false );
- echo get_post_meta ( $post_id, 'sp_team' ) ? sp_the_posts( $post_id, 'sp_team', '', '
', $result, ( empty( $result ) ? ' — ' : ' ' ) ) : '—';
+ $results = get_post_meta( $post_id, 'sp_results', true );
+ $teams = get_post_meta ( $post_id, 'sp_team', false );
+ foreach( $teams as $team_id ):
+ $team = get_post( $team_id );
+ $outcome_slug = sp_array_value( sp_array_value( $results, $team_id, null ), 'outcome', null );
+
+ $args=array(
+ 'name' => $outcome_slug,
+ 'post_type' => 'sp_outcome',
+ 'post_status' => 'publish',
+ 'posts_per_page' => 1
+ );
+ $outcomes = get_posts( $args );
+ echo $team->post_title . ( $outcomes ? ' — ' . $outcomes[0]->post_title : '' ) . '
';
+ endforeach;
break;
case 'sp_equation':
$equation = get_post_meta ( $post_id, 'sp_equation', true );
@@ -86,6 +99,9 @@ function sp_manage_posts_custom_column( $column, $post_id ) {
echo get_the_title( $post_id );
endif;
break;
+ case 'sp_key':
+ echo $post->post_name;
+ break;
case 'sp_player':
echo sp_the_posts( $post_id, 'sp_player' );
break;
diff --git a/sportspress-functions.php b/sportspress-functions.php
index df5745a5..4ccdb7fe 100644
--- a/sportspress-functions.php
+++ b/sportspress-functions.php
@@ -175,7 +175,7 @@ if ( !function_exists( 'sp_dropdown_pages' ) ) {
}
if ( !function_exists( 'sp_the_posts' ) ) {
- function sp_the_posts( $post_id = null, $meta = 'post', $before = '', $sep = ', ', $after = '', $delimiter = ' - ' ) {
+ function sp_the_posts( $post_id = null, $meta = 'post' ) {
if ( ! isset( $post_id ) )
global $post_id;
$ids = get_post_meta( $post_id, $meta, false );
@@ -186,34 +186,19 @@ if ( !function_exists( 'sp_the_posts' ) ) {
if ( isset( $ids ) && $ids && is_array( $ids ) && !empty( $ids ) ):
foreach ( $ids as $id ):
if ( !$id ) continue;
- if ( !empty( $before ) ):
- if ( is_array( $before ) && array_key_exists( $i, $before ) )
- echo $before[ $i ] . ' - ';
- else
- echo $before;
- endif;
$parents = get_post_ancestors( $id );
$parents = array_combine( array_keys( $parents ), array_reverse( array_values( $parents ) ) );
foreach ( $parents as $parent ):
if ( !in_array( $parent, $ids ) )
edit_post_link( get_the_title( $parent ), '', '', $parent );
- echo $delimiter;
+ echo ' - ';
endforeach;
$title = get_the_title( $id );
if ( empty( $title ) )
$title = __( '(no title)', 'sportspress' );
edit_post_link( $title, '', '', $id );
- if ( !empty( $after ) ):
- if ( is_array( $after ) ):
- if ( array_key_exists( $i, $after ) && $after[ $i ] != '' ):
- echo ' - ' . $after[ $i ];
- endif;
- else:
- echo $after;
- endif;
- endif;
if ( ++$i !== $count )
- echo $sep;
+ echo ', ';
endforeach;
endif;
}