| @@ 318-338 (lines=21) @@ | ||
| 315 | /** |
|
| 316 | * Grab all the current destination posts via the lsx_wetu_id field. |
|
| 317 | */ |
|
| 318 | public function find_current_destination($post_type = 'destination') |
|
| 319 | { |
|
| 320 | global $wpdb; |
|
| 321 | $return = array(); |
|
| 322 | ||
| 323 | $current_destination = $wpdb->get_results(" |
|
| 324 | SELECT key1.post_id,key1.meta_value,key2.post_title as name,key2.post_date as last_modified |
|
| 325 | FROM {$wpdb->postmeta} key1 |
|
| 326 | ||
| 327 | INNER JOIN {$wpdb->posts} key2 |
|
| 328 | ON key1.post_id = key2.ID |
|
| 329 | ||
| 330 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 331 | AND key2.post_type = '{$post_type}' |
|
| 332 | ||
| 333 | LIMIT 0,500 |
|
| 334 | "); |
|
| 335 | if (null !== $current_destination && !empty($current_destination)) { |
|
| 336 | foreach ($current_destination as $accom) { |
|
| 337 | $return[$accom->meta_value] = $accom; |
|
| 338 | } |
|
| 339 | } |
|
| 340 | return $return; |
|
| 341 | } |
|
| @@ 1043-1063 (lines=21) @@ | ||
| 1040 | /** |
|
| 1041 | * Grab all the current accommodation posts via the lsx_wetu_id field. |
|
| 1042 | */ |
|
| 1043 | public function find_current_accommodation($post_type='accommodation') { |
|
| 1044 | global $wpdb; |
|
| 1045 | $return = array(); |
|
| 1046 | ||
| 1047 | $current_accommodation = $wpdb->get_results(" |
|
| 1048 | SELECT key1.post_id,key1.meta_value |
|
| 1049 | FROM {$wpdb->postmeta} key1 |
|
| 1050 | ||
| 1051 | INNER JOIN {$wpdb->posts} key2 |
|
| 1052 | ON key1.post_id = key2.ID |
|
| 1053 | ||
| 1054 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 1055 | AND key2.post_type = '{$post_type}' |
|
| 1056 | ||
| 1057 | LIMIT 0,500 |
|
| 1058 | "); |
|
| 1059 | if(null !== $current_accommodation && !empty($current_accommodation)){ |
|
| 1060 | foreach($current_accommodation as $accom){ |
|
| 1061 | $return[$accom->meta_value] = $accom; |
|
| 1062 | } |
|
| 1063 | } |
|
| 1064 | return $return; |
|
| 1065 | } |
|
| 1066 | } |
|
| @@ 332-352 (lines=21) @@ | ||
| 329 | /** |
|
| 330 | * Grab all the current tour posts via the lsx_wetu_id field. |
|
| 331 | */ |
|
| 332 | public function find_current_tours() { |
|
| 333 | global $wpdb; |
|
| 334 | $return = array(); |
|
| 335 | ||
| 336 | $current_tours = $wpdb->get_results(" |
|
| 337 | SELECT key1.post_id,key1.meta_value |
|
| 338 | FROM {$wpdb->postmeta} key1 |
|
| 339 | ||
| 340 | INNER JOIN {$wpdb->posts} key2 |
|
| 341 | ON key1.post_id = key2.ID |
|
| 342 | ||
| 343 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 344 | AND key2.post_type = 'tour' |
|
| 345 | ||
| 346 | LIMIT 0,500 |
|
| 347 | "); |
|
| 348 | if(null !== $current_tours && !empty($current_tours)){ |
|
| 349 | foreach($current_tours as $tour){ |
|
| 350 | $return[$tour->meta_value] = $tour; |
|
| 351 | } |
|
| 352 | } |
|
| 353 | return $return; |
|
| 354 | } |
|
| 355 | ||