Add API filter for date/time and functions for taxonomies

This commit is contained in:
Brian Miyaji
2016-04-05 09:42:00 +10:00
parent bacd7b1939
commit 4fb695d0fc

View File

@@ -21,8 +21,8 @@ function sp_get_time( $post = 0, $format = null ) {
return get_post_time( $format, false, $post, true );
}
function sp_the_time( $post = 0 ) {
echo sp_get_time( $post );
function sp_the_time( $post = 0, $format = null ) {
echo sp_get_time( $post, $format );
}
function sp_get_date( $post = 0, $format = null ) {
@@ -30,8 +30,8 @@ function sp_get_date( $post = 0, $format = null ) {
return get_post_time( $format, false, $post, true );
}
function sp_the_date( $post = 0 ) {
echo sp_get_date( $post );
function sp_the_date( $post = 0, $format = null ) {
echo sp_get_date( $post, $format );
}
function sp_get_posts( $post_type = 'post', $args = array() ) {
@@ -55,6 +55,28 @@ function sp_get_seasons( $post = 0, $ids = true ) {
return $terms;
}
function sp_the_leagues( $post = 0, $delimiter = ', ' ) {
$terms = sp_get_leagues( $post, false );
$arr = array();
if ( $terms ) {
foreach ( $terms as $term ):
$arr[] = $term->name;
endforeach;
}
echo implode( $delimiter, $arr );
}
function sp_the_seasons( $post = 0, $delimiter = ', ' ) {
$terms = sp_get_seasons( $post, false );
$arr = array();
if ( $terms ) {
foreach ( $terms as $term ):
$arr[] = $term->name;
endforeach;
}
echo implode( $delimiter, $arr );
}
/*
* Event functions
*/
@@ -218,6 +240,17 @@ function sp_get_venues( $post = 0, $ids = true ) {
return $terms;
}
function sp_the_venues( $post = 0, $delimiter = ', ' ) {
$terms = sp_get_venues( $post, false );
$arr = array();
if ( $terms ) {
foreach ( $terms as $term ):
$arr[] = $term->name;
endforeach;
}
echo implode( $delimiter, $arr );
}
function sp_is_home_venue( $post = 0, $event = 0 ) {
$pv = sp_get_venues( $post );
$ev = sp_get_venues( $event );