Add player number and name API functions
This commit is contained in:
@@ -230,6 +230,20 @@ function sp_league_table( $post = 0 ) {
|
||||
* Player functions
|
||||
*/
|
||||
|
||||
function sp_get_player_number( $post = 0 ) {
|
||||
$player = new SP_Player( $post );
|
||||
return $player->number;
|
||||
}
|
||||
|
||||
function sp_get_player_name_with_number( $post = 0, $prepend = '', $append = '. ' ) {
|
||||
$number = sp_get_player_number( $post );
|
||||
if ( isset( $number ) && '' !== $number ) {
|
||||
return $prepend . $number . $append . get_the_title( $post );
|
||||
} else {
|
||||
return get_the_title( $post );
|
||||
}
|
||||
}
|
||||
|
||||
function sp_player_details( $post = 0 ) {
|
||||
sp_get_template( 'player-details.php', array( 'id' => $post ) );
|
||||
}
|
||||
|
||||
@@ -838,7 +838,7 @@ if ( !function_exists( 'sp_post_checklist' ) ) {
|
||||
<?php echo str_repeat( '<ul><li>', sizeof( $parents ) ); ?>
|
||||
<label class="selectit">
|
||||
<input type="checkbox" value="<?php echo $post->ID; ?>" name="<?php echo $meta; ?><?php if ( isset( $index ) ) echo '[' . $index . ']'; ?>[]"<?php if ( in_array( $post->ID, $selected ) ) echo ' checked="checked"'; ?>>
|
||||
<?php echo sp_draft_or_post_title( $post ); ?>
|
||||
<?php echo sp_get_player_name_with_number( $post->ID ); ?>
|
||||
</label>
|
||||
<?php echo str_repeat( '</li></ul>', sizeof( $parents ) ); ?>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user