Add next event function to team
This commit is contained in:
@@ -12,6 +12,27 @@
|
||||
*/
|
||||
class SP_Team extends SP_Custom_Post {
|
||||
|
||||
public function next_event() {
|
||||
$args = array(
|
||||
'post_type' => 'sp_event',
|
||||
'numberposts' => 1,
|
||||
'posts_per_page' => 1,
|
||||
'order' => 'ASC',
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => 'sp_team',
|
||||
'value' => $this->ID
|
||||
)
|
||||
)
|
||||
);
|
||||
$events = get_posts( $args );
|
||||
|
||||
if ( count( $events ) )
|
||||
return array_shift( $events );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns formatted data
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user