Add player positions to icon box score

This commit is contained in:
Brian Miyaji
2017-01-16 20:12:56 +11:00
parent aa502f3fec
commit 11970dd4ad
2 changed files with 21 additions and 8 deletions

View File

@@ -292,6 +292,10 @@
padding-left: 10px; padding-left: 10px;
} }
.sp-template-event-performance-icons .sp-player-position {
display: block;
}
/* Event Calendar */ /* Event Calendar */
.sp-event-calendar { .sp-event-calendar {
border-spacing: 0; border-spacing: 0;

View File

@@ -97,9 +97,8 @@ if ( ! isset( $subs ) ) $subs = array();
$name .= ' <span class="sub-out" title="' . get_the_title( $row[ 'sub' ] ) . '">' . sp_array_value( sp_array_value( $data, $subbed, array() ), 'number', null ) . '</span>'; $name .= ' <span class="sub-out" title="' . get_the_title( $row[ 'sub' ] ) . '">' . sp_array_value( sp_array_value( $data, $subbed, array() ), 'number', null ) . '</span>';
endif; endif;
echo '<td class="data-name">' . $name . '</td>'; $content = '';
$position = null;
if ( $mode == 'icons' ) echo '<td class="sp-performance-icons">';
foreach ( $labels as $key => $label ): foreach ( $labels as $key => $label ):
if ( 'name' == $key ) if ( 'name' == $key )
@@ -133,7 +132,7 @@ if ( ! isset( $subs ) ) $subs = array();
$positions = array_unique( $positions ); $positions = array_unique( $positions );
if ( sizeof( $positions ) ): if ( sizeof( $positions ) ):
$value = implode( ', ', $positions ); $value = $position = implode( ', ', $positions );
endif; endif;
else: else:
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ): if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
@@ -149,18 +148,28 @@ if ( ! isset( $subs ) ) $subs = array();
endif; endif;
if ( $mode == 'values' ): if ( $mode == 'values' ):
echo '<td class="data-' . $key . '">' . $value . '</td>'; $content .= '<td class="data-' . $key . '">' . $value . '</td>';
elseif ( intval( $value ) && $mode == 'icons' ): elseif ( intval( $value ) && $mode == 'icons' ):
$performance_id = sp_array_value( $performance_ids, $key, null ); $performance_id = sp_array_value( $performance_ids, $key, null );
$icons = ''; $icons = '';
if ( $performance_id && has_post_thumbnail( $performance_id ) ): if ( $performance_id && has_post_thumbnail( $performance_id ) ):
$icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $performance_id ) ) ) . ' ', $value ); $icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $performance_id ) ) ) . ' ', $value );
endif; endif;
echo apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value ); $content .= apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value );
endif; endif;
endforeach; endforeach;
if ( $mode == 'icons' ) echo '</td>'; if ( isset( $position ) && $mode == 'icons' ):
$name .= ' <small class="sp-player-position">' . $position . '</small>';
endif;
echo '<td class="data-name">' . $name . '</td>';
if ( $mode == 'icons' ):
echo '<td class="sp-performance-icons">' . $content . '</td>';
else:
echo $content;
endif;
echo '</tr>'; echo '</tr>';