| @@ 334-354 (lines=21) @@ | ||
| 331 | /** |
|
| 332 | * Grab all the current tour posts via the lsx_wetu_id field. |
|
| 333 | */ |
|
| 334 | public function find_current_tours() { |
|
| 335 | global $wpdb; |
|
| 336 | $return = array(); |
|
| 337 | ||
| 338 | $current_tours = $wpdb->get_results(" |
|
| 339 | SELECT key1.post_id,key1.meta_value |
|
| 340 | FROM {$wpdb->postmeta} key1 |
|
| 341 | ||
| 342 | INNER JOIN {$wpdb->posts} key2 |
|
| 343 | ON key1.post_id = key2.ID |
|
| 344 | ||
| 345 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 346 | AND key2.post_type = 'tour' |
|
| 347 | ||
| 348 | LIMIT 0,500 |
|
| 349 | "); |
|
| 350 | if(null !== $current_tours && !empty($current_tours)){ |
|
| 351 | foreach($current_tours as $tour){ |
|
| 352 | $return[$tour->meta_value] = $tour; |
|
| 353 | } |
|
| 354 | } |
|
| 355 | return $return; |
|
| 356 | } |
|
| 357 | ||
| @@ 286-306 (lines=21) @@ | ||
| 283 | /** |
|
| 284 | * Grab all the current destination posts via the lsx_wetu_id field. |
|
| 285 | */ |
|
| 286 | public function find_current_destination($post_type = 'destination') |
|
| 287 | { |
|
| 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 | } |
|
| @@ 1108-1128 (lines=21) @@ | ||
| 1105 | /** |
|
| 1106 | * Grab all the current accommodation posts via the lsx_wetu_id field. |
|
| 1107 | */ |
|
| 1108 | public function find_current_accommodation($post_type='accommodation') { |
|
| 1109 | global $wpdb; |
|
| 1110 | $return = array(); |
|
| 1111 | ||
| 1112 | $current_accommodation = $wpdb->get_results(" |
|
| 1113 | SELECT key1.post_id,key1.meta_value |
|
| 1114 | FROM {$wpdb->postmeta} key1 |
|
| 1115 | ||
| 1116 | INNER JOIN {$wpdb->posts} key2 |
|
| 1117 | ON key1.post_id = key2.ID |
|
| 1118 | ||
| 1119 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 1120 | AND key2.post_type = '{$post_type}' |
|
| 1121 | ||
| 1122 | LIMIT 0,5000 |
|
| 1123 | "); |
|
| 1124 | if(null !== $current_accommodation && !empty($current_accommodation)){ |
|
| 1125 | foreach($current_accommodation as $accom){ |
|
| 1126 | $return[$accom->meta_value] = $accom; |
|
| 1127 | } |
|
| 1128 | } |
|
| 1129 | return $return; |
|
| 1130 | } |
|
| 1131 | ||