| @@ 506-532 (lines=27) @@ | ||
| 503 | $post['post_excerpt'] = $data_post_excerpt; |
|
| 504 | } |
|
| 505 | ||
| 506 | if(false !== $id && '0' !== $id){ |
|
| 507 | $post['ID'] = $id; |
|
| 508 | if(isset($data[0]['name'])){ |
|
| 509 | $post['post_title'] = $data[0]['name']; |
|
| 510 | $post['post_status'] = 'publish'; |
|
| 511 | $post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'destination', 0); |
|
| 512 | } |
|
| 513 | $id = wp_update_post($post); |
|
| 514 | $prev_date = get_post_meta($id,'lsx_wetu_modified_date',true); |
|
| 515 | update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date); |
|
| 516 | }else{ |
|
| 517 | ||
| 518 | //Set the name |
|
| 519 | if(isset($data[0]['name'])){ |
|
| 520 | $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'destination', 0); |
|
| 521 | } |
|
| 522 | $post['post_name'] = $post_name; |
|
| 523 | $post['post_title'] = $data[0]['name']; |
|
| 524 | $post['post_status'] = 'publish'; |
|
| 525 | $id = wp_insert_post($post); |
|
| 526 | ||
| 527 | //Save the WETU ID and the Last date it was modified. |
|
| 528 | if(false !== $id){ |
|
| 529 | add_post_meta($id,'lsx_wetu_id',$wetu_id); |
|
| 530 | add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified'])); |
|
| 531 | } |
|
| 532 | } |
|
| 533 | ||
| 534 | //Set the team member if it is there |
|
| 535 | if(post_type_exists('team') && false !== $team_members && '' !== $team_members){ |
|
| @@ 599-625 (lines=27) @@ | ||
| 596 | $post['post_excerpt'] = $data_post_excerpt; |
|
| 597 | } |
|
| 598 | ||
| 599 | if(false !== $id && '0' !== $id){ |
|
| 600 | $post['ID'] = $id; |
|
| 601 | if(isset($data[0]['name'])){ |
|
| 602 | $post['post_title'] = $data[0]['name']; |
|
| 603 | $post['post_status'] = 'publish'; |
|
| 604 | $post['post_name'] = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0); |
|
| 605 | } |
|
| 606 | $id = wp_update_post($post); |
|
| 607 | $prev_date = get_post_meta($id,'lsx_wetu_modified_date',true); |
|
| 608 | update_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified']),$prev_date); |
|
| 609 | }else{ |
|
| 610 | ||
| 611 | //Set the name |
|
| 612 | if(isset($data[0]['name'])){ |
|
| 613 | $post_name = wp_unique_post_slug(sanitize_title($data[0]['name']),$id, 'draft', 'accommodation', 0); |
|
| 614 | } |
|
| 615 | $post['post_name'] = $post_name; |
|
| 616 | $post['post_title'] = $data[0]['name']; |
|
| 617 | $post['post_status'] = 'publish'; |
|
| 618 | $id = wp_insert_post($post); |
|
| 619 | ||
| 620 | //Save the WETU ID and the Last date it was modified. |
|
| 621 | if(false !== $id){ |
|
| 622 | add_post_meta($id,'lsx_wetu_id',$wetu_id); |
|
| 623 | add_post_meta($id,'lsx_wetu_modified_date',strtotime($data[0]['last_modified'])); |
|
| 624 | } |
|
| 625 | } |
|
| 626 | //Setup some default for use in the import |
|
| 627 | if(false !== $importable_content && (in_array('gallery',$importable_content) || in_array('banner_image',$importable_content) || in_array('featured_image',$importable_content))){ |
|
| 628 | $this->find_attachments($id); |
|