Fix table and list html to omit columns not used

This commit is contained in:
Brian Miyaji
2014-01-06 21:35:03 +11:00
parent 9ed92d7af3
commit 5c9b126307

View File

@@ -1430,22 +1430,15 @@ if ( !function_exists( 'sp_get_table_html' ) ) {
$output .= '<tr>'; $output .= '<tr>';
foreach( $row as $key => $value ): // Thumbnail and name as link
$output .= '<td>'; $permalink = get_post_permalink( $team_id );
if ( $key == 'name' ): $thumbnail = get_the_post_thumbnail( $team_id, 'sp_icon' );
$permalink = get_post_permalink( $team_id ); $output .= '<td>' . $i . '. ' . ( $thumbnail ? $thumbnail . ' ' : '' ) . '<a href="' . $permalink . '">' . sp_array_value( $row, 'name', '&nbsp;' ) . '</a></td>';
$thumbnail = get_the_post_thumbnail( $team_id, 'sp_icon' );
$output .= $i . ' '; foreach( $labels as $key => $value ):
if ( $thumbnail ): if ( $key == 'name' )
$output .= '<a href="' . $permalink . '">' . $thumbnail . '</a> '; continue;
endif; $output .= '<td>' . sp_array_value( $row, $key, '—' ) . '</td>';
$output .= '<a href="' . $permalink . '">';
endif;
$output .= $value;
if ( $key == 'name' ):
$output .= '</a>';
endif;
$output .= '</td>';
endforeach; endforeach;
$output .= '</tr>'; $output .= '</tr>';
@@ -1484,17 +1477,15 @@ if ( !function_exists( 'sp_get_list_html' ) ) {
$output .= '<tr>'; $output .= '<tr>';
foreach( $row as $key => $value ): // Name as link
$output .= '<td>'; $permalink = get_post_permalink( $player_id );
if ( $key == 'name' ): $number = get_post_meta( $player_id, 'sp_number', true );
$permalink = get_post_permalink( $player_id ); $output .= '<td>' . ( $number ? $number . '. ' : '' ) . '<a href="' . $permalink . '">' . sp_array_value( $row, 'name', '&nbsp;' ) . '</a></td>';
$output .= '<a href="' . $permalink . '">';
endif; foreach( $labels as $key => $value ):
$output .= $value; if ( $key == 'name' )
if ( $key == 'name' ): continue;
$output .= '</a>'; $output .= '<td>' . sp_array_value( $row, $key, '—' ) . '</td>';
endif;
$output .= '</td>';
endforeach; endforeach;
$output .= '</tr>'; $output .= '</tr>';