| @@ 549-577 (lines=29) @@ | ||
| 546 | $post['post_excerpt'] = $data_post_excerpt; |
|
| 547 | } |
|
| 548 | ||
| 549 | if ( false !== $id && '0' !== $id ) { |
|
| 550 | $post['ID'] = $id; |
|
| 551 | ||
| 552 | if ( isset( $data[0]['name'] ) ) { |
|
| 553 | $post['post_title'] = $data[0]['name']; |
|
| 554 | $post['post_status'] = 'publish'; |
|
| 555 | $post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ),$id, 'draft', 'accommodation', 0 ); |
|
| 556 | } |
|
| 557 | ||
| 558 | $id = wp_update_post( $post ); |
|
| 559 | $prev_date = get_post_meta( $id,'lsx_wetu_modified_date', true ); |
|
| 560 | update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date ); |
|
| 561 | } else { |
|
| 562 | //Set the name |
|
| 563 | if ( isset( $data[0]['name'] ) ) { |
|
| 564 | $post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ),$id, 'draft', 'accommodation', 0 ); |
|
| 565 | } |
|
| 566 | ||
| 567 | $post['post_name'] = $post_name; |
|
| 568 | $post['post_title'] = $data[0]['name']; |
|
| 569 | $post['post_status'] = 'publish'; |
|
| 570 | $id = wp_insert_post( $post ); |
|
| 571 | ||
| 572 | //Save the WETU ID and the Last date it was modified. |
|
| 573 | if ( false !== $id ) { |
|
| 574 | add_post_meta( $id,'lsx_wetu_id',$wetu_id ); |
|
| 575 | add_post_meta( $id,'lsx_wetu_modified_date',strtotime( $data[0]['last_modified'] ) ); |
|
| 576 | } |
|
| 577 | } |
|
| 578 | ||
| 579 | //Setup some default for use in the import |
|
| 580 | if ( false !== $importable_content && (in_array( 'gallery',$importable_content ) || in_array( 'banner_image',$importable_content ) || in_array( 'featured_image',$importable_content )) ) { |
|
| @@ 593-621 (lines=29) @@ | ||
| 590 | } |
|
| 591 | } |
|
| 592 | ||
| 593 | if ( false !== $id && '0' !== $id ) { |
|
| 594 | $post['ID'] = $id; |
|
| 595 | ||
| 596 | if ( isset( $data[0]['name'] ) ) { |
|
| 597 | $post['post_title'] = $data[0]['name']; |
|
| 598 | $post['post_status'] = 'publish'; |
|
| 599 | $post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 ); |
|
| 600 | } |
|
| 601 | ||
| 602 | $id = wp_update_post( $post ); |
|
| 603 | $prev_date = get_post_meta( $id, 'lsx_wetu_modified_date', true ); |
|
| 604 | update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date ); |
|
| 605 | } else { |
|
| 606 | //Set the name |
|
| 607 | if ( isset( $data[0]['name'] ) ) { |
|
| 608 | $post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 ); |
|
| 609 | } |
|
| 610 | ||
| 611 | $post['post_name'] = $post_name; |
|
| 612 | $post['post_title'] = $data[0]['name']; |
|
| 613 | $post['post_status'] = 'publish'; |
|
| 614 | $id = wp_insert_post( $post ); |
|
| 615 | ||
| 616 | //Save the WETU ID and the Last date it was modified. |
|
| 617 | if ( false !== $id ) { |
|
| 618 | add_post_meta( $id, 'lsx_wetu_id', $wetu_id ); |
|
| 619 | add_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ) ); |
|
| 620 | } |
|
| 621 | } |
|
| 622 | ||
| 623 | $this->find_attachments( $id ); |
|
| 624 | ||