1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Template Tags |
4
|
|
|
* |
5
|
|
|
* @package LSX_TO_Reviews |
6
|
|
|
* @license GPL-2.0+ |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Outputs the posts attached review |
11
|
|
|
* |
12
|
|
|
* @package to-reviews |
|
|
|
|
13
|
|
|
* @subpackage template-tags |
|
|
|
|
14
|
|
|
* @category review |
|
|
|
|
15
|
|
|
*/ |
16
|
|
|
if ( ! function_exists( 'lsx_to_review_posts' ) ) { |
|
|
|
|
17
|
|
|
function lsx_to_review_posts() { |
|
|
|
|
18
|
|
|
global $lsx_to_archive; |
19
|
|
|
|
20
|
|
|
$args = array( |
21
|
|
|
'from' => 'post', |
|
|
|
|
22
|
|
|
'to' => 'review', |
|
|
|
|
23
|
|
|
'column' => '3', |
|
|
|
|
24
|
|
|
'before' => '<section id="posts" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-posts">' . esc_html__( 'Featured Posts', 'to-reviews' ) . '</h2><div id="collapse-posts" class="collapse in"><div class="collapse-inner">', |
|
|
|
|
25
|
|
|
'after' => '</div></div></section>', |
|
|
|
|
26
|
|
|
); |
27
|
|
|
|
28
|
|
|
lsx_to_connected_panel_query( $args ); |
29
|
|
|
} |
|
|
|
|
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
|
|
|
|
33
|
|
|
* Find the content part in the plugin |
34
|
|
|
* |
35
|
|
|
* @package to-reviews |
|
|
|
|
36
|
|
|
* @subpackage template-tag |
|
|
|
|
37
|
|
|
* @category content |
|
|
|
|
38
|
|
|
*/ |
39
|
|
|
function lsx_to_review_content( $slug, $name = null ) { |
|
|
|
|
40
|
|
|
do_action( 'lsx_to_review_content', $slug, $name ); |
41
|
|
|
} |
|
|
|
|
42
|
|
|
|
43
|
|
|
/* ================ REVIEWS =========================== */ |
44
|
|
|
/** |
|
|
|
|
45
|
|
|
* Gets the current reviews rating |
46
|
|
|
* |
47
|
|
|
* @param $before | string |
|
|
|
|
48
|
|
|
* @param $after | string |
|
|
|
|
49
|
|
|
* @param $echo | boolean |
|
|
|
|
50
|
|
|
* @return string |
|
|
|
|
51
|
|
|
* |
52
|
|
|
* @package lsx-tour-operators |
|
|
|
|
53
|
|
|
* @subpackage template-tags |
|
|
|
|
54
|
|
|
* @category review |
|
|
|
|
55
|
|
|
*/ |
56
|
|
|
function lsx_to_review_rating( $before = '', $after = '', $echo = true ) { |
|
|
|
|
57
|
|
|
lsx_to_custom_field_query( 'rating', $before, $after, $echo ); |
58
|
|
|
} |
|
|
|
|
59
|
|
|
|
60
|
|
|
/** |
|
|
|
|
61
|
|
|
* Outputs the reviews dates |
62
|
|
|
* |
63
|
|
|
* @param $before | string |
|
|
|
|
64
|
|
|
* @param $after | string |
|
|
|
|
65
|
|
|
* @param $echo | boolean |
|
|
|
|
66
|
|
|
* @return string |
|
|
|
|
67
|
|
|
* |
68
|
|
|
* @package lsx-tour-operators |
|
|
|
|
69
|
|
|
* @subpackage template-tags |
|
|
|
|
70
|
|
|
* @category review |
|
|
|
|
71
|
|
|
*/ |
72
|
|
|
function lsx_to_review_dates( $before = '', $after = '', $echo = true ) { |
73
|
|
|
$valid_from = get_post_meta( get_the_ID(), 'date_of_visit_start', true ); |
|
|
|
|
74
|
|
|
$valid_to = get_post_meta( get_the_ID(), 'date_of_visit_end', true ); |
|
|
|
|
75
|
|
|
|
76
|
|
|
if ( false !== $valid_from && '' !== $valid_from ) { |
|
|
|
|
77
|
|
|
$valid_from = date( 'd M Y', strtotime( $valid_from ) ); |
|
|
|
|
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
if ( false !== $valid_to && '' !== $valid_to ) { |
|
|
|
|
81
|
|
|
$valid_from .= ' - ' . date( 'd M Y', strtotime( $valid_to ) ); |
|
|
|
|
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
if ( false !== $valid_from && '' !== $valid_from ) { |
|
|
|
|
85
|
|
|
$return = $before . $valid_from . $after; |
86
|
|
|
|
87
|
|
|
if ( $echo ) { |
|
|
|
|
88
|
|
|
echo $return; |
|
|
|
|
89
|
|
|
} else { |
90
|
|
|
return $return; |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
} |
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Outputs the connected accommodation for a review |
96
|
|
|
* |
97
|
|
|
* @package lsx-tour-operators |
|
|
|
|
98
|
|
|
* @subpackage template-tags |
|
|
|
|
99
|
|
|
* @category review |
|
|
|
|
100
|
|
|
*/ |
101
|
|
|
function lsx_to_review_accommodation() { |
102
|
|
|
global $lsx_archive; |
103
|
|
|
|
104
|
|
|
if ( post_type_exists( 'accommodation' ) && is_singular( 'review' ) ) { |
|
|
|
|
105
|
|
|
$args = array( |
106
|
|
|
'from' => 'accommodation', |
|
|
|
|
107
|
|
|
'to' => 'review', |
|
|
|
|
108
|
|
|
'column' => '3', |
|
|
|
|
109
|
|
|
'before' => '<section id="accommodation" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-accommodation">' . __( lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ), 'to-reviews' ) . '</h2><div id="collapse-accommodation" class="collapse in"><div class="collapse-inner">', |
|
|
|
|
110
|
|
|
'after' => '</div></div></section>', |
|
|
|
|
111
|
|
|
); |
112
|
|
|
|
113
|
|
|
lsx_to_connected_panel_query( $args ); |
114
|
|
|
} |
115
|
|
|
} |
|
|
|
|
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Outputs the connected tour only a review |
119
|
|
|
* |
120
|
|
|
* @package lsx-tour-operators |
|
|
|
|
121
|
|
|
* @subpackage template-tags |
|
|
|
|
122
|
|
|
* @category review |
|
|
|
|
123
|
|
|
*/ |
124
|
|
|
function lsx_to_review_tour() { |
125
|
|
|
global $lsx_archive; |
126
|
|
|
|
127
|
|
|
if ( post_type_exists( 'tour' ) && is_singular( 'review' ) ) { |
|
|
|
|
128
|
|
|
$args = array( |
129
|
|
|
'from' => 'tour', |
|
|
|
|
130
|
|
|
'to' => 'review', |
|
|
|
|
131
|
|
|
'column' => '3', |
|
|
|
|
132
|
|
|
'before' => '<section id="tours" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-tours">' . __( lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ), 'to-reviews' ) . '</h2><div id="collapse-tours" class="collapse in"><div class="collapse-inner">', |
|
|
|
|
133
|
|
|
'after' => '</div></div></section>', |
|
|
|
|
134
|
|
|
); |
135
|
|
|
|
136
|
|
|
lsx_to_connected_panel_query( $args ); |
137
|
|
|
} |
138
|
|
|
} |
|
|
|
|
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Outputs the connected destination only a review |
142
|
|
|
* |
143
|
|
|
* @package lsx-tour-operators |
|
|
|
|
144
|
|
|
* @subpackage template-tags |
|
|
|
|
145
|
|
|
* @category review |
|
|
|
|
146
|
|
|
*/ |
147
|
|
|
function lsx_to_review_destination() { |
148
|
|
|
global $lsx_archive; |
149
|
|
|
|
150
|
|
|
if ( post_type_exists( 'destination' ) && is_singular( 'review' ) ) { |
|
|
|
|
151
|
|
|
$args = array( |
152
|
|
|
'from' => 'destination', |
|
|
|
|
153
|
|
|
'to' => 'review', |
|
|
|
|
154
|
|
|
'column' => '3', |
|
|
|
|
155
|
|
|
'before' => '<section id="destinations" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-destinations">' . __( lsx_to_get_post_type_section_title( 'destination', '', 'Featured Destinations' ), 'to-reviews' ) . '</h2><div id="collapse-destinations" class="collapse in"><div class="collapse-inner">', |
|
|
|
|
156
|
|
|
'after' => '</div></div></section>', |
|
|
|
|
157
|
|
|
); |
158
|
|
|
|
159
|
|
|
lsx_to_connected_panel_query( $args ); |
160
|
|
|
} |
161
|
|
|
} |
|
|
|
|
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* Outputs the connected reviews for an accommodation |
165
|
|
|
* |
166
|
|
|
* @package lsx-tour-operators |
|
|
|
|
167
|
|
|
* @subpackage template-tags |
|
|
|
|
168
|
|
|
* @category review |
|
|
|
|
169
|
|
|
*/ |
170
|
|
|
function lsx_to_accommodation_reviews() { |
171
|
|
|
global $lsx_archive; |
172
|
|
|
|
173
|
|
|
if ( post_type_exists( 'review' ) && is_singular( 'accommodation' ) ) { |
|
|
|
|
174
|
|
|
$args = array( |
175
|
|
|
'from' => 'review', |
|
|
|
|
176
|
|
|
'to' => 'accommodation', |
|
|
|
|
177
|
|
|
'column' => '2', |
|
|
|
|
178
|
|
|
'before' => '<section id="review" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-review">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Reviews' ), 'to-reviews' ) . '</h2><div id="collapse-review" class="collapse in"><div class="collapse-inner">', |
|
|
|
|
179
|
|
|
'after' => '</div></div></section>', |
|
|
|
|
180
|
|
|
); |
181
|
|
|
|
182
|
|
|
lsx_to_connected_panel_query( $args ); |
183
|
|
|
} |
184
|
|
|
} |
|
|
|
|
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Outputs the connected reviews for a tour |
188
|
|
|
* |
189
|
|
|
* @package lsx-tour-operators |
|
|
|
|
190
|
|
|
* @subpackage template-tags |
|
|
|
|
191
|
|
|
* @category review |
|
|
|
|
192
|
|
|
*/ |
193
|
|
|
function lsx_to_tour_reviews() { |
194
|
|
|
global $lsx_archive; |
195
|
|
|
|
196
|
|
|
if ( post_type_exists( 'review' ) && is_singular( 'tour' ) ) { |
|
|
|
|
197
|
|
|
$args = array( |
198
|
|
|
'from' => 'review', |
|
|
|
|
199
|
|
|
'to' => 'tour', |
|
|
|
|
200
|
|
|
'column' => '2', |
|
|
|
|
201
|
|
|
'before' => '<section id="review" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-review">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Reviews' ), 'to-reviews' ) . '</h2><div id="collapse-review" class="collapse in"><div class="collapse-inner">', |
|
|
|
|
202
|
|
|
'after' => '</div></div></section>', |
|
|
|
|
203
|
|
|
); |
204
|
|
|
|
205
|
|
|
lsx_to_connected_panel_query( $args ); |
206
|
|
|
} |
207
|
|
|
} |
|
|
|
|
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* Outputs the connected reviews for a destination |
211
|
|
|
* |
212
|
|
|
* @package lsx-tour-operators |
|
|
|
|
213
|
|
|
* @subpackage template-tags |
|
|
|
|
214
|
|
|
* @category review |
|
|
|
|
215
|
|
|
*/ |
216
|
|
|
function lsx_to_destination_reviews() { |
217
|
|
|
global $lsx_archive; |
218
|
|
|
|
219
|
|
|
if ( post_type_exists( 'review' ) && is_singular( 'destination' ) ) { |
|
|
|
|
220
|
|
|
$args = array( |
221
|
|
|
'from' => 'review', |
|
|
|
|
222
|
|
|
'to' => 'destination', |
|
|
|
|
223
|
|
|
'column' => '2', |
|
|
|
|
224
|
|
|
'before' => '<section id="review" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-review">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Reviews' ), 'to-reviews' ) . '</h2><div id="collapse-review" class="collapse in"><div class="collapse-inner">', |
|
|
|
|
225
|
|
|
'after' => '</div></div></section>', |
|
|
|
|
226
|
|
|
); |
227
|
|
|
|
228
|
|
|
lsx_to_connected_panel_query( $args ); |
229
|
|
|
} |
230
|
|
|
} |
|
|
|
|
231
|
|
|
|
232
|
|
|
/** |
|
|
|
|
233
|
|
|
* Gets the current specials connected reviews |
234
|
|
|
* |
235
|
|
|
* @param $before | string |
|
|
|
|
236
|
|
|
* @param $after | string |
|
|
|
|
237
|
|
|
* @param $echo | boolean |
|
|
|
|
238
|
|
|
* @return string |
|
|
|
|
239
|
|
|
* |
240
|
|
|
* @package tour-operator |
|
|
|
|
241
|
|
|
* @subpackage template-tags |
|
|
|
|
242
|
|
|
* @category connections |
|
|
|
|
243
|
|
|
*/ |
244
|
|
|
function lsx_to_connected_reviews( $before = '', $after = '', $echo = true ) { |
245
|
|
|
lsx_to_connected_items_query( 'review', get_post_type(), $before, $after, $echo ); |
246
|
|
|
} |
|
|
|
|
247
|
|
|
|