Display staff as paragraph text

This commit is contained in:
Brian Miyaji
2014-06-18 15:51:50 +10:00
parent fedbdb72e4
commit 34c8698c9e
2 changed files with 29 additions and 40 deletions

View File

@@ -44,6 +44,11 @@ foreach( $teams as $index => $team_id ):
$data = sp_array_combine( $players, sp_array_value( $data, $team_id, array() ) );
?>
<h3><?php echo get_the_title( $team_id ); ?></h3>
<?php
if ( get_option( 'sportspress_event_show_staff', 'yes' ) == 'yes' ):
sp_get_template( 'event-staff.php', array( 'id' => $id, 'index' => $index ) );
endif;
?>
<div class="sp-table-wrapper sp-scrollable-table-wrapper">
<table class="sp-event-performance sp-data-table <?php if ( $responsive ) { ?> sp-responsive-table<?php } if ( $has_players && $sortable ) { ?> sp-sortable-table<?php } ?>">
<thead>
@@ -155,5 +160,5 @@ foreach( $teams as $index => $team_id ):
<?php endif; ?>
</table>
</div>
<?php if ( get_option( 'sportspress_event_show_staff', 'yes' ) == 'yes' ) sp_get_template( 'event-staff.php', array( 'id' => $id, 'index' => $index ) ); ?>
<?php endforeach;
<?php
endforeach;

View File

@@ -12,10 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$defaults = array(
'id' => get_the_ID(),
'index' => 0,
'number' => -1,
'link_posts' => get_option( 'sportspress_event_link_staff', 'yes' ) == 'yes' ? true : false,
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false,
);
$staff = array_filter( sp_array_between( (array)get_post_meta( $id, 'sp_staff', false ), 0, $index ) );
@@ -24,17 +21,8 @@ if ( ! $staff ) return;
extract( $defaults, EXTR_SKIP );
?>
<div class="sp-table-wrapper sp-scrollable-table-wrapper">
<table class="sp-event-performance sp-data-table <?php if ( $responsive ) { ?> sp-responsive-table<?php } if ( $sortable ) { ?> sp-sortable-table<?php } ?>">
<thead>
<tr>
<th class="data-name"><?php _e( 'Staff', 'sportspress' ); ?></th>
<th class="data-role"><?php _e( 'Role', 'sportspress' ); ?></th>
</tr>
</thead>
<tbody>
<p class="sp-event-staff">
<?php
$i = 0;
foreach( $staff as $staff_id ):
if ( ! $staff_id )
@@ -45,26 +33,22 @@ extract( $defaults, EXTR_SKIP );
if ( ! $name )
continue;
echo '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
$role = get_post_meta( $staff_id, 'sp_role', true );
if ( $role )
echo $role;
else
_e( 'Staff', 'sportspress' );
echo ': ';
if ( $link_posts ):
$permalink = get_post_permalink( $staff_id );
$name = '<a href="' . $permalink . '">' . $name . '</a>';
endif;
echo '<td class="data-name">' . $name . '</td>';
$role = get_post_meta( $staff_id, 'sp_role', true );
// Staff role
echo '<td class="data-role">' . $role . '</td>';
echo '</tr>';
$i++;
echo $name . '<br>';
endforeach;
?>
</tbody>
</table>
</div>
</p>