| @@ 249-269 (lines=21) @@ | ||
| 246 | /** |
|
| 247 | * Grab all the current tour posts via the lsx_wetu_id field. |
|
| 248 | */ |
|
| 249 | public function find_current_tours() { |
|
| 250 | global $wpdb; |
|
| 251 | $return = array(); |
|
| 252 | ||
| 253 | $current_tours = $wpdb->get_results(" |
|
| 254 | SELECT key1.post_id,key1.meta_value |
|
| 255 | FROM {$wpdb->postmeta} key1 |
|
| 256 | ||
| 257 | INNER JOIN {$wpdb->posts} key2 |
|
| 258 | ON key1.post_id = key2.ID |
|
| 259 | ||
| 260 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 261 | AND key2.post_type = 'tour' |
|
| 262 | ||
| 263 | LIMIT 0,500 |
|
| 264 | "); |
|
| 265 | if(null !== $current_tours && !empty($current_tours)){ |
|
| 266 | foreach($current_tours as $tour){ |
|
| 267 | $return[$tour->meta_value] = $tour; |
|
| 268 | } |
|
| 269 | } |
|
| 270 | return $return; |
|
| 271 | } |
|
| 272 | ||
| @@ 298-318 (lines=21) @@ | ||
| 295 | /** |
|
| 296 | * Grab all the current accommodation posts via the lsx_wetu_id field. |
|
| 297 | */ |
|
| 298 | public function find_current_accommodation($post_type='accommodation') { |
|
| 299 | global $wpdb; |
|
| 300 | $return = array(); |
|
| 301 | ||
| 302 | $current_accommodation = $wpdb->get_results(" |
|
| 303 | SELECT key1.post_id,key1.meta_value |
|
| 304 | FROM {$wpdb->postmeta} key1 |
|
| 305 | ||
| 306 | INNER JOIN {$wpdb->posts} key2 |
|
| 307 | ON key1.post_id = key2.ID |
|
| 308 | ||
| 309 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 310 | AND key2.post_type = '{$post_type}' |
|
| 311 | ||
| 312 | LIMIT 0,500 |
|
| 313 | "); |
|
| 314 | if(null !== $current_accommodation && !empty($current_accommodation)){ |
|
| 315 | foreach($current_accommodation as $accom){ |
|
| 316 | $return[$accom->meta_value] = $accom; |
|
| 317 | } |
|
| 318 | } |
|
| 319 | return $return; |
|
| 320 | } |
|
| 321 | ||
| @@ 258-278 (lines=21) @@ | ||
| 255 | /** |
|
| 256 | * Grab all the current destination posts via the lsx_wetu_id field. |
|
| 257 | */ |
|
| 258 | public function find_current_destination($post_type='destination') { |
|
| 259 | global $wpdb; |
|
| 260 | $return = array(); |
|
| 261 | ||
| 262 | $current_destination = $wpdb->get_results(" |
|
| 263 | SELECT key1.post_id,key1.meta_value,key2.post_title as name,key2.post_date as last_modified |
|
| 264 | FROM {$wpdb->postmeta} key1 |
|
| 265 | ||
| 266 | INNER JOIN {$wpdb->posts} key2 |
|
| 267 | ON key1.post_id = key2.ID |
|
| 268 | ||
| 269 | WHERE key1.meta_key = 'lsx_wetu_id' |
|
| 270 | AND key2.post_type = '{$post_type}' |
|
| 271 | ||
| 272 | LIMIT 0,500 |
|
| 273 | "); |
|
| 274 | if(null !== $current_destination && !empty($current_destination)){ |
|
| 275 | foreach($current_destination as $accom){ |
|
| 276 | $return[$accom->meta_value] = $accom; |
|
| 277 | } |
|
| 278 | } |
|
| 279 | return $return; |
|
| 280 | } |
|
| 281 | ||