PluginProbe
Event Post / 5.10.0
Event Post v5.10.0
6.1.1 6.1.0 6.0.1 6.0.0 5.12.0 trunk 3.9 4.0 4.2 4.3 4.4 4.5 5.0 5.1 5.10.0 5.10.1 5.10.2 5.10.3 5.10.4 5.11.0 5.11.1 5.2 5.5 5.6 5.6.1 All 46 releases
event-post / inc / wrappers.php

wrappers.php in Event Post 5.10.0, at inc/wrappers.php

136 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Shortcuts for useful functions in templates
4 *
5 * @package event-post
6 * @version 5.10.0
7 * @since 5.0.0
8 */
9
10 if(!function_exists('get_the_dates')){
11 /**
12 * Returns the HTML string of the given event's date range.
13 * If no post reference is given, the current post will be used
14 *
15 * @param mixte $post
16 *
17 * @global \EventPost $EventPost
18 *
19 * @return string
20 *
21 * @example:
22 * <pre>
23 * <div class="event_date" data-start="april 6 2017 12am" data-end="april 6 2017 1pm">
24 * <time itemprop="dtstart" datetime="2017-04-06T12:08:00+00:00">
25 * <span class="date date-single">april 6 2017, 8am</span>
26 * <span class="linking_word linking_word-from">from</span>
27 * <span class="time time-start">12h am</span>
28 * <span class="linking_word linking_word-to">to</span>
29 * <span class="time time-end">1h am</span>
30 * </time>
31 * </div>
32 * </pre>
33 */
34 function get_the_dates($_post=null){
35 global $EventPost, $post;
36 if(!$_post){
37 $_post = $post;
38 }
39 return $EventPost->print_date($_post);
40 }
41 }
42 if(!function_exists('the_dates')){
43 /**
44 * Outputs the HTML generated by `get_the_dates`
45 *
46 * @param mixte $post
47 */
48 function the_dates($post=null){
49 echo get_the_dates($post);
50 }
51 }
52
53 if(!function_exists('get_the_date_start')){
54 /**
55 * Returns the HTML of the start date of an event
56 *
57 * @param type $post
58 *
59 * @global \EventPost $EventPost
60 *
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 * Outputs the HTML of the start date of an event
72 *
73 * @param type $post
74 */
75 function the_date_start($post=null){
76 echo get_the_date_start($post);
77 }
78 }
79
80 if(!function_exists('get_the_date_end')){
81 /**
82 * Returns the HTML of the end date of an event
83 *
84 * @param type $post
85 *
86 * @global \EventPost $EventPost
87 *
88 * @return string
89 */
90 function get_the_date_end($post=null){
91 global $EventPost;
92 $event = $EventPost->retreive($post);
93 return $EventPost->human_date($event->time_end, $EventPost->settings['dateformat']);
94 }
95 }
96 if(!function_exists('the_date_end')){
97 /**
98 * Outputs the HTML of the start date of an event
99 *
100 * @param type $post
101 *
102 * @global \EventPost $EventPost
103 *
104 * @return string
105 */
106 function the_date_end($post=null){
107 echo get_the_date_end($post);
108 }
109 }
110
111 if(!function_exists('get_the_location')){
112 /**
113 * Returns the HTML of the location date of an event
114 *
115 * @param type $post
116 *
117 * @global \EventPost $EventPost
118 *
119 * @return string
120 */
121 function get_the_location($post=null){
122 global $EventPost;
123 return $EventPost->print_location($post);
124 }
125 }
126 if(!function_exists('the_location')){
127 /**
128 * Outputs the HTML of the location date of an event
129 *
130 * @param type $post
131 */
132 function the_location($post=null){
133 echo get_the_location($post);
134 }
135 }
136