| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
if(!function_exists('get_the_dates')){ |
| 5 |
/** |
| 6 |
* Returns the HTML string of the given event's date range. |
| 7 |
* If no post reference is given, the current post will be used |
| 8 |
* |
| 9 |
* @global \EventPost $EventPost |
| 10 |
* @param mixte $post |
| 11 |
* @uses EventPost:print_date |
| 12 |
* @return string |
| 13 |
* |
| 14 |
* example: |
| 15 |
* <pre> |
| 16 |
<div class="event_date" data-start="april 6 2017 12am" data-end="april 6 2017 1pm"> |
| 17 |
<time itemprop="dtstart" datetime="2017-04-06T12:08:00+00:00"> |
| 18 |
<span class="date date-single">april 6 2017, 8am</span> |
| 19 |
<span class="linking_word linking_word-from">from</span> |
| 20 |
<span class="time time-start">12h am</span> |
| 21 |
<span class="linking_word linking_word-to">to</span> |
| 22 |
<span class="time time-end">1h am</span> |
| 23 |
</time> |
| 24 |
</div> |
| 25 |
</pre> |
| 26 |
* |
| 27 |
* @example |
| 28 |
* <pre> |
| 29 |
* <?php echo get_the_dates(); ?> |
| 30 |
* </pre> |
| 31 |
* |
| 32 |
*/ |
| 33 |
function get_the_dates($_post=null){ |
| 34 |
global $EventPost, $post; |
| 35 |
if(!$_post){ |
| 36 |
$_post = $post; |
| 37 |
} |
| 38 |
return $EventPost->print_date($_post); |
| 39 |
} |
| 40 |
} |
| 41 |
if(!function_exists('the_dates')){ |
| 42 |
/** |
| 43 |
* Outputs the HTML generated by `get_the_dates` |
| 44 |
* @param mixte $post |
| 45 |
* @uses get_the_dates |
| 46 |
* @example |
| 47 |
* <pre> |
| 48 |
* <?php the_dates(); ?> |
| 49 |
* </pre> |
| 50 |
*/ |
| 51 |
function the_dates($post=null){ |
| 52 |
echo get_the_dates($post); |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
if(!function_exists('get_the_date_start')){ |
| 57 |
/** |
| 58 |
* |
| 59 |
* @global \EventPost $EventPost |
| 60 |
* @param type $post |
| 61 |
* @return string |
| 62 |
*/ |
| 63 |
function get_the_date_start($post=null){ |
| 64 |
global $EventPost; |
| 65 |
$event = $EventPost->retreive($post); |
| 66 |
return $EventPost->human_date($event->time_start, $EventPost->settings['dateformat']); |
| 67 |
} |
| 68 |
} |
| 69 |
if(!function_exists('the_date_start')){ |
| 70 |
/** |
| 71 |
* |
| 72 |
* @param type $post |
| 73 |
*/ |
| 74 |
function the_date_start($post=null){ |
| 75 |
echo get_the_date_start($post); |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
if(!function_exists('get_the_date_end')){ |
| 80 |
/** |
| 81 |
* |
| 82 |
* @global \EventPost $EventPost |
| 83 |
* @param type $post |
| 84 |
* @return string |
| 85 |
*/ |
| 86 |
function get_the_date_end($post=null){ |
| 87 |
global $EventPost; |
| 88 |
$event = $EventPost->retreive($post); |
| 89 |
return $EventPost->human_date($event->time_end, $EventPost->settings['dateformat']); |
| 90 |
} |
| 91 |
} |
| 92 |
if(!function_exists('the_date_end')){ |
| 93 |
/** |
| 94 |
* |
| 95 |
*/ |
| 96 |
function the_date_end($post=null){ |
| 97 |
echo get_the_date_end($post); |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
if(!function_exists('get_the_location')){ |
| 102 |
/** |
| 103 |
* |
| 104 |
* @global \EventPost $EventPost |
| 105 |
* @param type $post |
| 106 |
* @return string |
| 107 |
*/ |
| 108 |
function get_the_location($post=null){ |
| 109 |
global $EventPost; |
| 110 |
return $EventPost->print_location($post); |
| 111 |
} |
| 112 |
} |
| 113 |
if(!function_exists('the_location')){ |
| 114 |
/** |
| 115 |
* |
| 116 |
* @param type $post |
| 117 |
*/ |
| 118 |
function the_location($post=null){ |
| 119 |
echo get_the_location($post); |
| 120 |
} |
| 121 |
} |