1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Template Tags |
4
|
|
|
* |
5
|
|
|
* @package LSX_Vehicles |
6
|
|
|
* @license GPL-2.0+ |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
/** |
|
|
|
|
10
|
|
|
* Find the content part in the plugin |
11
|
|
|
* |
12
|
|
|
* @package to-vehicles |
13
|
|
|
* @subpackage template-tag |
14
|
|
|
* @category content |
15
|
|
|
*/ |
16
|
|
|
function lsx_vehicle_content( $slug, $name = null ) { |
|
|
|
|
17
|
|
|
do_action( 'lsx_vehicle_content', $slug, $name ); |
18
|
|
|
} |
|
|
|
|
19
|
|
|
|
20
|
|
|
/* ================ VEHICLES =========================== */ |
21
|
|
|
/** |
|
|
|
|
22
|
|
|
* Outputs the current vehicles code. |
23
|
|
|
* |
24
|
|
|
* @param $before | string |
|
|
|
|
25
|
|
|
* @param $after | string |
|
|
|
|
26
|
|
|
* @param $echo | boolean |
|
|
|
|
27
|
|
|
* @return string |
|
|
|
|
28
|
|
|
* |
29
|
|
|
* @package lsx-tour-operators |
30
|
|
|
* @subpackage template-tags |
31
|
|
|
* @category vehicle |
32
|
|
|
*/ |
33
|
|
|
function lsx_vehicle_code( $before = '', $after = '', $echo = true ) { |
|
|
|
|
34
|
|
|
lsx_to_custom_field_query( 'code', $before, $after, $echo ); |
35
|
|
|
} |
|
|
|
|
36
|
|
|
/** |
|
|
|
|
37
|
|
|
* Outputs the current vehicles vehicle_type. |
38
|
|
|
* |
39
|
|
|
* @param $before | string |
|
|
|
|
40
|
|
|
* @param $after | string |
|
|
|
|
41
|
|
|
* @param $echo | boolean |
|
|
|
|
42
|
|
|
* @return string |
|
|
|
|
43
|
|
|
* |
44
|
|
|
* @package lsx-tour-operators |
45
|
|
|
* @subpackage template-tags |
46
|
|
|
* @category vehicle |
47
|
|
|
*/ |
48
|
|
|
function lsx_vehicle_type( $before = '', $after = '', $echo = true ) { |
49
|
|
|
lsx_to_custom_field_query( 'vehicle_type', $before, $after, $echo ); |
50
|
|
|
} |
|
|
|
|
51
|
|
|
/** |
|
|
|
|
52
|
|
|
* Outputs the current vehicles price. |
53
|
|
|
* |
54
|
|
|
* @param $before | string |
|
|
|
|
55
|
|
|
* @param $after | string |
|
|
|
|
56
|
|
|
* @param $echo | boolean |
|
|
|
|
57
|
|
|
* @return string |
|
|
|
|
58
|
|
|
* |
59
|
|
|
* @package lsx-tour-operators |
60
|
|
|
* @subpackage template-tags |
61
|
|
|
* @category vehicle |
62
|
|
|
*/ |
63
|
|
|
function lsx_vehicle_price( $before = '', $after = '', $echo = true ) { |
64
|
|
|
lsx_to_custom_field_query( 'price', $before, $after, $echo ); |
65
|
|
|
} |
|
|
|
|
66
|
|
|
/** |
|
|
|
|
67
|
|
|
* Outputs the current vehicles engine_type. |
68
|
|
|
* |
69
|
|
|
* @param $before | string |
|
|
|
|
70
|
|
|
* @param $after | string |
|
|
|
|
71
|
|
|
* @param $echo | boolean |
|
|
|
|
72
|
|
|
* @return string |
|
|
|
|
73
|
|
|
* |
74
|
|
|
* @package lsx-tour-operators |
75
|
|
|
* @subpackage template-tags |
76
|
|
|
* @category vehicle |
77
|
|
|
*/ |
78
|
|
|
function lsx_vehicle_engine_type( $before = '', $after = '', $echo = true ) { |
79
|
|
|
lsx_to_custom_field_query( 'engine_type', $before, $after, $echo ); |
80
|
|
|
} |
|
|
|
|
81
|
|
|
/** |
|
|
|
|
82
|
|
|
* Outputs the current vehicles gearbox. |
83
|
|
|
* |
84
|
|
|
* @param $before | string |
|
|
|
|
85
|
|
|
* @param $after | string |
|
|
|
|
86
|
|
|
* @param $echo | boolean |
|
|
|
|
87
|
|
|
* @return string |
|
|
|
|
88
|
|
|
* |
89
|
|
|
* @package lsx-tour-operators |
90
|
|
|
* @subpackage template-tags |
91
|
|
|
* @category vehicle |
92
|
|
|
*/ |
93
|
|
|
function lsx_vehicle_gearbox( $before = '', $after = '', $echo = true ) { |
94
|
|
|
lsx_to_custom_field_query( 'gearbox', $before, $after, $echo ); |
95
|
|
|
} |
|
|
|
|
96
|
|
|
/** |
|
|
|
|
97
|
|
|
* Outputs the current vehicles engine_size. |
98
|
|
|
* |
99
|
|
|
* @param $before | string |
|
|
|
|
100
|
|
|
* @param $after | string |
|
|
|
|
101
|
|
|
* @param $echo | boolean |
|
|
|
|
102
|
|
|
* @return string |
|
|
|
|
103
|
|
|
* |
104
|
|
|
* @package lsx-tour-operators |
105
|
|
|
* @subpackage template-tags |
106
|
|
|
* @category vehicle |
107
|
|
|
*/ |
108
|
|
|
function lsx_vehicle_engine_size( $before = '', $after = '', $echo = true ) { |
109
|
|
|
lsx_to_custom_field_query( 'engine_size', $before, $after, $echo ); |
110
|
|
|
} |
|
|
|
|
111
|
|
|
/** |
|
|
|
|
112
|
|
|
* Outputs the current vehicles gears. |
113
|
|
|
* |
114
|
|
|
* @param $before | string |
|
|
|
|
115
|
|
|
* @param $after | string |
|
|
|
|
116
|
|
|
* @param $echo | boolean |
|
|
|
|
117
|
|
|
* @return string |
|
|
|
|
118
|
|
|
* |
119
|
|
|
* @package lsx-tour-operators |
120
|
|
|
* @subpackage template-tags |
121
|
|
|
* @category vehicle |
122
|
|
|
*/ |
123
|
|
|
function lsx_vehicle_gears( $before = '', $after = '', $echo = true ) { |
124
|
|
|
lsx_to_custom_field_query( 'gears', $before, $after, $echo ); |
125
|
|
|
} |
|
|
|
|
126
|
|
|
/** |
|
|
|
|
127
|
|
|
* Outputs the current vehicles seating. |
128
|
|
|
* |
129
|
|
|
* @param $before | string |
|
|
|
|
130
|
|
|
* @param $after | string |
|
|
|
|
131
|
|
|
* @param $echo | boolean |
|
|
|
|
132
|
|
|
* @return string |
|
|
|
|
133
|
|
|
* |
134
|
|
|
* @package lsx-tour-operators |
135
|
|
|
* @subpackage template-tags |
136
|
|
|
* @category vehicle |
137
|
|
|
*/ |
138
|
|
|
function lsx_vehicle_seating( $before = '', $after = '', $echo = true ) { |
139
|
|
|
lsx_to_custom_field_query( 'seating', $before, $after, $echo ); |
140
|
|
|
} |
|
|
|
|
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Checks if the current vehicle has featured |
144
|
|
|
* @return string |
|
|
|
|
145
|
|
|
* |
146
|
|
|
* @package lsx-tour-operators |
147
|
|
|
* @subpackage template-tags |
148
|
|
|
* @category vehicle |
149
|
|
|
*/ |
150
|
|
|
function lsx_has_vehicle_features() { |
151
|
|
|
return lsx_to_has_custom_field_query( 'features', get_the_ID() ); |
152
|
|
|
} |
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Outputs the Vehicles Custom Fields on the Single Vehicle Templates |
155
|
|
|
* |
156
|
|
|
* @package lsx-tour-operators |
157
|
|
|
* @subpackage template-tags |
158
|
|
|
* @category vehicle |
159
|
|
|
*/ |
160
|
|
|
function lsx_vehicle_features() { |
161
|
|
|
if ( is_singular( 'vehicle' ) ) { |
|
|
|
|
162
|
|
|
$features = lsx_to_custom_field_query( 'features', '', '', false ); |
163
|
|
|
if ( null !== $features ) { ?> |
|
|
|
|
164
|
|
|
<section id="features"> |
165
|
|
|
<div class="row"> |
166
|
|
|
<?php if ( null !== $features ) { ?> |
|
|
|
|
167
|
|
|
<div class=" col-sm-12"> |
168
|
|
|
<h3 class="section-title"><?php esc_html_e( 'Features', 'to-vehicles' ); ?></h3> |
169
|
|
|
<div class="entry-content"> |
170
|
|
|
<?php |
171
|
|
|
$the_feature = apply_filters( 'the_content', $features ); |
172
|
|
|
?> |
173
|
|
|
<?php echo wp_kses_post( $the_feature ); ?> |
174
|
|
|
</div> |
175
|
|
|
</div> |
176
|
|
|
<?php } ?> |
177
|
|
|
</div> |
178
|
|
|
</section> |
179
|
|
|
<?php |
180
|
|
|
} |
181
|
|
|
} |
182
|
|
|
} |
|
|
|
|
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Outputs the connected accommodation for a vehicle |
186
|
|
|
* |
187
|
|
|
* @package lsx-tour-operators |
188
|
|
|
* @subpackage template-tags |
189
|
|
|
* @category vehicle |
190
|
|
|
*/ |
191
|
|
|
function lsx_vehicle_accommodation() { |
192
|
|
|
global $lsx_archive; |
193
|
|
|
if ( post_type_exists( 'accommodation' ) && is_singular( 'vehicle' ) ) { |
|
|
|
|
194
|
|
|
$args = array( |
195
|
|
|
'from' => 'accommodation', |
196
|
|
|
'to' => 'vehicle', |
197
|
|
|
'column' => '3', |
198
|
|
|
'before' => '<section id="accommodation"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ) . '</h2>', |
199
|
|
|
'after' => '</section>', |
200
|
|
|
); |
201
|
|
|
lsx_to_connected_panel_query( $args ); |
202
|
|
|
} |
203
|
|
|
} |
|
|
|
|
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* Outputs the connected vehicles for a destination |
207
|
|
|
* |
208
|
|
|
* @package lsx-tour-operators |
|
|
|
|
209
|
|
|
* @subpackage template-tags |
|
|
|
|
210
|
|
|
* @category vehicle |
|
|
|
|
211
|
|
|
*/ |
212
|
|
|
function lsx_to_destination_vehicles() { |
213
|
|
|
global $lsx_archive; |
214
|
|
|
|
215
|
|
|
if ( post_type_exists( 'vehicle' ) && is_singular( 'destination' ) ) { |
|
|
|
|
216
|
|
|
$args = array( |
217
|
|
|
'from' => 'vehicle', |
|
|
|
|
218
|
|
|
'to' => 'destination', |
|
|
|
|
219
|
|
|
'column' => '3', |
|
|
|
|
220
|
|
|
'before' => '<section id="vehicle" 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-special">' . lsx_to_get_post_type_section_title( 'vehicle', '', __( 'Featured Vehicles', 'to-vehicles' ) ) . '</h2><div id="collapse-vehicle" class="collapse in"><div class="collapse-inner">', |
|
|
|
|
221
|
|
|
'after' => '</div></div></section>', |
|
|
|
|
222
|
|
|
); |
223
|
|
|
|
224
|
|
|
lsx_to_connected_panel_query( $args ); |
225
|
|
|
} |
226
|
|
|
} |
|
|
|
|
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* Outputs the connected tours only a vehicle |
230
|
|
|
* |
231
|
|
|
* @package lsx-tour-operators |
232
|
|
|
* @subpackage template-tags |
233
|
|
|
* @category vehicle |
234
|
|
|
*/ |
235
|
|
|
function lsx_vehicle_tours() { |
236
|
|
|
global $lsx_archive; |
237
|
|
|
if ( post_type_exists( 'tour' ) && is_singular( 'vehicle' ) ) { |
|
|
|
|
238
|
|
|
$args = array( |
239
|
|
|
'from' => 'tour', |
240
|
|
|
'to' => 'vehicle', |
241
|
|
|
'column' => '3', |
242
|
|
|
'before' => '<section id="tours"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ) . '</h2>', |
243
|
|
|
'after' => '</section>', |
244
|
|
|
); |
245
|
|
|
lsx_to_connected_panel_query( $args ); |
246
|
|
|
} |
247
|
|
|
} |
|
|
|
|
248
|
|
|
|