Display staff as paragraph text
This commit is contained in:
@@ -44,6 +44,11 @@ foreach( $teams as $index => $team_id ):
|
|||||||
$data = sp_array_combine( $players, sp_array_value( $data, $team_id, array() ) );
|
$data = sp_array_combine( $players, sp_array_value( $data, $team_id, array() ) );
|
||||||
?>
|
?>
|
||||||
<h3><?php echo get_the_title( $team_id ); ?></h3>
|
<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">
|
<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 } ?>">
|
<table class="sp-event-performance sp-data-table <?php if ( $responsive ) { ?> sp-responsive-table<?php } if ( $has_players && $sortable ) { ?> sp-sortable-table<?php } ?>">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -155,5 +160,5 @@ foreach( $teams as $index => $team_id ):
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php if ( get_option( 'sportspress_event_show_staff', 'yes' ) == 'yes' ) sp_get_template( 'event-staff.php', array( 'id' => $id, 'index' => $index ) ); ?>
|
<?php
|
||||||
<?php endforeach;
|
endforeach;
|
||||||
|
|||||||
@@ -12,10 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||||||
$defaults = array(
|
$defaults = array(
|
||||||
'id' => get_the_ID(),
|
'id' => get_the_ID(),
|
||||||
'index' => 0,
|
'index' => 0,
|
||||||
'number' => -1,
|
|
||||||
'link_posts' => get_option( 'sportspress_event_link_staff', 'yes' ) == 'yes' ? true : false,
|
'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 ) );
|
$staff = array_filter( sp_array_between( (array)get_post_meta( $id, 'sp_staff', false ), 0, $index ) );
|
||||||
@@ -24,47 +21,34 @@ if ( ! $staff ) return;
|
|||||||
|
|
||||||
extract( $defaults, EXTR_SKIP );
|
extract( $defaults, EXTR_SKIP );
|
||||||
?>
|
?>
|
||||||
<div class="sp-table-wrapper sp-scrollable-table-wrapper">
|
<p class="sp-event-staff">
|
||||||
<table class="sp-event-performance sp-data-table <?php if ( $responsive ) { ?> sp-responsive-table<?php } if ( $sortable ) { ?> sp-sortable-table<?php } ?>">
|
<?php
|
||||||
<thead>
|
foreach( $staff as $staff_id ):
|
||||||
<tr>
|
|
||||||
<th class="data-name"><?php _e( 'Staff', 'sportspress' ); ?></th>
|
|
||||||
<th class="data-role"><?php _e( 'Role', 'sportspress' ); ?></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
$i = 0;
|
|
||||||
foreach( $staff as $staff_id ):
|
|
||||||
|
|
||||||
if ( ! $staff_id )
|
if ( ! $staff_id )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$name = get_the_title( $staff_id );
|
$name = get_the_title( $staff_id );
|
||||||
|
|
||||||
if ( ! $name )
|
if ( ! $name )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
echo '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
$role = get_post_meta( $staff_id, 'sp_role', true );
|
||||||
|
|
||||||
if ( $link_posts ):
|
if ( $role )
|
||||||
$permalink = get_post_permalink( $staff_id );
|
echo $role;
|
||||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
else
|
||||||
endif;
|
_e( 'Staff', 'sportspress' );
|
||||||
|
|
||||||
echo '<td class="data-name">' . $name . '</td>';
|
echo ': ';
|
||||||
|
|
||||||
$role = get_post_meta( $staff_id, 'sp_role', true );
|
if ( $link_posts ):
|
||||||
|
$permalink = get_post_permalink( $staff_id );
|
||||||
|
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||||
|
endif;
|
||||||
|
|
||||||
// Staff role
|
echo $name . '<br>';
|
||||||
echo '<td class="data-role">' . $role . '</td>';
|
|
||||||
|
|
||||||
echo '</tr>';
|
endforeach;
|
||||||
|
?>
|
||||||
$i++;
|
</p>
|
||||||
|
|
||||||
endforeach;
|
|
||||||
?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
Reference in New Issue
Block a user