Add API functions for cleaner templates
This commit is contained in:
37
includes/sp-api-functions.php
Normal file
37
includes/sp-api-functions.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* SportsPress API Functions
|
||||
*
|
||||
* API functions for admin and front-end templates.
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @category Core
|
||||
* @package SportsPress/Functions
|
||||
* @version 1.4
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
/*
|
||||
* General functions
|
||||
*/
|
||||
function sp_get_time( $post = null ) {
|
||||
return get_post_time( get_option( 'time_format' ), false, $post, true );
|
||||
}
|
||||
|
||||
function sp_time( $post = null ) {
|
||||
echo sp_get_time( $post );
|
||||
}
|
||||
|
||||
/*
|
||||
* Event functions
|
||||
*/
|
||||
function sp_get_main_results( $post = null ) {
|
||||
$event = new SP_Event( $post );
|
||||
return $event->main_results();
|
||||
}
|
||||
|
||||
function sp_main_results( $post = null ) {
|
||||
$results = sp_get_main_results( $post );
|
||||
echo implode( ' - ', $results );
|
||||
}
|
||||
Reference in New Issue
Block a user