Display scores next to teams in admin

This commit is contained in:
Takumi
2013-07-28 01:06:24 +10:00
parent bc36a575f5
commit d29eb1ac0a
4 changed files with 15 additions and 6 deletions

View File

@@ -19,7 +19,7 @@ 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':
echo get_post_meta ( $post_id, 'sp_team' ) ? sp_the_posts( $post_id, 'sp_team', '', '<br />' ) : '—';
echo get_post_meta ( $post_id, 'sp_team' ) ? sp_the_posts( $post_id, 'sp_team', '', '<br />', get_post_meta( $post_id, 'sp_score', false ) ) : '—';
break;
case 'sp_event':
echo get_post_meta ( $post_id, 'sp_event' ) ? sizeof( get_post_meta ( $post_id, 'sp_event' ) ) : '—';

View File

@@ -28,7 +28,7 @@ add_filter( 'the_posts', 'sp_event_display_scheduled' );
function sp_event_meta_init() {
remove_meta_box( 'submitdiv', 'sp_event', 'side' );
add_meta_box( 'submitdiv', __( 'Event', 'sportspress' ), 'post_submit_meta_box', 'sp_event', 'side', 'high' );
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_event_team_meta', 'sp_event', 'side', 'high' );
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_event_team_meta', 'sp_event', 'normal', 'high' );
add_meta_box( 'sp_articlediv', __( 'Article', 'sportspress' ), 'sp_event_article_meta', 'sp_event', 'normal', 'high' );
}

View File

@@ -68,7 +68,6 @@ if ( ! function_exists( 'sp_dropdown_taxonomies' ) ) {
if ( ! function_exists( 'sp_the_posts' ) ) {
function sp_the_posts( $post_id = null, $meta = 'post', $before = '', $sep = ', ', $after = '', $delimiter = '— ' ) {
echo $before;
if ( ! isset( $post_id ) )
global $post_id;
$posts = get_post_meta( $post_id, $meta, false );
@@ -76,6 +75,12 @@ if ( ! function_exists( 'sp_the_posts' ) ) {
$count = count( $posts );
if ( isset( $posts ) && $posts && is_array( $posts ) ):
foreach ( $posts as $post ):
if ( !empty( $before ) ):
if ( is_array( $before ) && array_key_exists( $i, $before ) )
echo $before[ $i ] . ' ';
else
echo $before;
endif;
$parents = get_post_ancestors( $post );
$parents = array_combine( array_keys( $parents ), array_reverse( array_values( $parents ) ) );
foreach ( $parents as $parent ):
@@ -84,12 +89,16 @@ if ( ! function_exists( 'sp_the_posts' ) ) {
echo $delimiter;
endforeach;
edit_post_link( get_the_title( $post ), '', '', $post );
if ( ++$i !== $count ) {
if ( !empty( $after ) ):
if ( is_array( $after ) && array_key_exists( $i, $after ) )
echo ' ' . $after[ $i ];
else
echo $after;
endif;
if ( ++$i !== $count )
echo $sep;
}
endforeach;
endif;
echo $after;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB