| @@ 538-564 (lines=27) @@ | ||
| 535 | $post['post_excerpt'] = $data_post_excerpt; |
|
| 536 | } |
|
| 537 | ||
| 538 | if ( false !== $id && '0' !== $id ) { |
|
| 539 | $post['ID'] = $id; |
|
| 540 | ||
| 541 | if ( isset( $data[0]['name'] ) ) { |
|
| 542 | $post['post_title'] = $data[0]['name']; |
|
| 543 | $post['post_status'] = 'publish'; |
|
| 544 | $post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ),$id, 'draft', 'accommodation', 0 ); |
|
| 545 | } |
|
| 546 | ||
| 547 | $id = wp_update_post( $post ); |
|
| 548 | $prev_date = get_post_meta( $id,'lsx_wetu_modified_date', true ); |
|
| 549 | update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date ); |
|
| 550 | } else { |
|
| 551 | //Set the name |
|
| 552 | if ( isset( $data[0]['name'] ) ) { |
|
| 553 | $post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ),$id, 'draft', 'accommodation', 0 ); |
|
| 554 | } |
|
| 555 | ||
| 556 | $post['post_name'] = $post_name; |
|
| 557 | $post['post_title'] = $data[0]['name']; |
|
| 558 | $post['post_status'] = 'publish'; |
|
| 559 | $id = wp_insert_post( $post ); |
|
| 560 | ||
| 561 | //Save the WETU ID and the Last date it was modified. |
|
| 562 | if ( false !== $id ) { |
|
| 563 | add_post_meta( $id,'lsx_wetu_id',$wetu_id ); |
|
| 564 | add_post_meta( $id,'lsx_wetu_modified_date',strtotime( $data[0]['last_modified'] ) ); |
|
| 565 | } |
|
| 566 | } |
|
| 567 | ||
| @@ 568-594 (lines=27) @@ | ||
| 565 | } |
|
| 566 | } |
|
| 567 | ||
| 568 | if ( false !== $id && '0' !== $id ) { |
|
| 569 | $post['ID'] = $id; |
|
| 570 | ||
| 571 | if ( isset( $data[0]['name'] ) ) { |
|
| 572 | $post['post_title'] = $data[0]['name']; |
|
| 573 | $post['post_status'] = 'publish'; |
|
| 574 | $post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 ); |
|
| 575 | } |
|
| 576 | ||
| 577 | $id = wp_update_post( $post ); |
|
| 578 | $prev_date = get_post_meta( $id, 'lsx_wetu_modified_date', true ); |
|
| 579 | update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date ); |
|
| 580 | } else { |
|
| 581 | //Set the name |
|
| 582 | if ( isset( $data[0]['name'] ) ) { |
|
| 583 | $post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 ); |
|
| 584 | } |
|
| 585 | ||
| 586 | $post['post_name'] = $post_name; |
|
| 587 | $post['post_title'] = $data[0]['name']; |
|
| 588 | $post['post_status'] = 'publish'; |
|
| 589 | $id = wp_insert_post( $post ); |
|
| 590 | ||
| 591 | //Save the WETU ID and the Last date it was modified. |
|
| 592 | if ( false !== $id ) { |
|
| 593 | add_post_meta( $id, 'lsx_wetu_id', $wetu_id ); |
|
| 594 | add_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ) ); |
|
| 595 | } |
|
| 596 | } |
|
| 597 | ||