Add venue API functions
This commit is contained in:
@@ -185,6 +185,22 @@ function sp_get_abbreviation( $post = 0 ) {
|
||||
return get_post_meta ( $post, 'sp_abbreviation', true );
|
||||
}
|
||||
|
||||
function sp_get_venues( $post = 0, $ids = true ) {
|
||||
$terms = get_the_terms( $post, 'sp_venue' );
|
||||
if ( $terms && $ids ) $terms = wp_list_pluck( $terms, 'term_id' );
|
||||
return $terms;
|
||||
}
|
||||
|
||||
function sp_is_home_venue( $post = 0, $event = 0 ) {
|
||||
$pv = sp_get_venues( $post );
|
||||
$ev = sp_get_venues( $event );
|
||||
if ( is_array( $pv ) && is_array( $ev ) && sizeof( array_intersect( $pv, $ev ) ) ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function sp_the_abbreviation( $post = 0 ) {
|
||||
echo sp_get_abbreviation( $post );
|
||||
}
|
||||
@@ -231,8 +247,7 @@ function sp_league_table( $post = 0 ) {
|
||||
*/
|
||||
|
||||
function sp_get_player_number( $post = 0 ) {
|
||||
$player = new SP_Player( $post );
|
||||
return $player->number;
|
||||
return get_post_meta( $post, 'sp_number', true );
|
||||
}
|
||||
|
||||
function sp_get_player_name_with_number( $post = 0, $prepend = '', $append = '. ' ) {
|
||||
|
||||
Reference in New Issue
Block a user