Add API functions for cleaner templates

This commit is contained in:
Brian Miyaji
2014-10-25 01:33:34 +11:00
parent 9886d4b4c6
commit e2c28e873c
7 changed files with 104 additions and 27 deletions

View 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 );
}