| @@ 287-307 (lines=21) @@ | ||
| 284 | /** |
|
| 285 | * Grab all the current destination posts via the lsx_wetu_id field. |
|
| 286 | */ |
|
| 287 | public function find_current_destination($post_type='destination') { |
|
| 288 | global $wpdb; |
|
| 289 | $return = array(); |
|
| 290 | ||
| 291 | $current_destination = $wpdb->get_results(" |
|
| 292 | SELECT key1.post_id,key1.meta_value,key2.post_title as name,key2.post_date as last_modified |
|
| 293 | FROM {$wpdb->postmeta} key1 |
|
| 294 | ||
| 295 | INNER JOIN {$wpdb->posts} key2 |
|
| 296 | ON key1.post_id = key2.ID |
|
| 297 | ||
| 298 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 299 | AND key2.post_type = '{$post_type}' |
|
| 300 | ||
| 301 | LIMIT 0,500 |
|
| 302 | "); |
|
| 303 | if(null !== $current_destination && !empty($current_destination)){ |
|
| 304 | foreach($current_destination as $accom){ |
|
| 305 | $return[$accom->meta_value] = $accom; |
|
| 306 | } |
|
| 307 | } |
|
| 308 | return $return; |
|
| 309 | } |
|
| 310 | ||
| @@ 279-299 (lines=21) @@ | ||
| 276 | /** |
|
| 277 | * Grab all the current tour posts via the lsx_wetu_id field. |
|
| 278 | */ |
|
| 279 | public function find_current_tours() { |
|
| 280 | global $wpdb; |
|
| 281 | $return = array(); |
|
| 282 | ||
| 283 | $current_tours = $wpdb->get_results(" |
|
| 284 | SELECT key1.post_id,key1.meta_value |
|
| 285 | FROM {$wpdb->postmeta} key1 |
|
| 286 | ||
| 287 | INNER JOIN {$wpdb->posts} key2 |
|
| 288 | ON key1.post_id = key2.ID |
|
| 289 | ||
| 290 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 291 | AND key2.post_type = 'tour' |
|
| 292 | ||
| 293 | LIMIT 0,500 |
|
| 294 | "); |
|
| 295 | if(null !== $current_tours && !empty($current_tours)){ |
|
| 296 | foreach($current_tours as $tour){ |
|
| 297 | $return[$tour->meta_value] = $tour; |
|
| 298 | } |
|
| 299 | } |
|
| 300 | return $return; |
|
| 301 | } |
|
| 302 | ||
| @@ 327-347 (lines=21) @@ | ||
| 324 | /** |
|
| 325 | * Grab all the current accommodation posts via the lsx_wetu_id field. |
|
| 326 | */ |
|
| 327 | public function find_current_accommodation($post_type='accommodation') { |
|
| 328 | global $wpdb; |
|
| 329 | $return = array(); |
|
| 330 | ||
| 331 | $current_accommodation = $wpdb->get_results(" |
|
| 332 | SELECT key1.post_id,key1.meta_value |
|
| 333 | FROM {$wpdb->postmeta} key1 |
|
| 334 | ||
| 335 | INNER JOIN {$wpdb->posts} key2 |
|
| 336 | ON key1.post_id = key2.ID |
|
| 337 | ||
| 338 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 339 | AND key2.post_type = '{$post_type}' |
|
| 340 | ||
| 341 | LIMIT 0,500 |
|
| 342 | "); |
|
| 343 | if(null !== $current_accommodation && !empty($current_accommodation)){ |
|
| 344 | foreach($current_accommodation as $accom){ |
|
| 345 | $return[$accom->meta_value] = $accom; |
|
| 346 | } |
|
| 347 | } |
|
| 348 | return $return; |
|
| 349 | } |
|
| 350 | ||