| @@ 526-552 (lines=27) @@ | ||
| 523 | $post['post_excerpt'] = $data_post_excerpt; |
|
| 524 | } |
|
| 525 | ||
| 526 | if ( false !== $id && '0' !== $id ) { |
|
| 527 | $post['ID'] = $id; |
|
| 528 | ||
| 529 | if ( isset( $data[0]['name'] ) ) { |
|
| 530 | $post['post_title'] = $data[0]['name']; |
|
| 531 | $post['post_status'] = 'publish'; |
|
| 532 | $post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ),$id, 'draft', 'accommodation', 0 ); |
|
| 533 | } |
|
| 534 | ||
| 535 | $id = wp_update_post( $post ); |
|
| 536 | $prev_date = get_post_meta( $id,'lsx_wetu_modified_date', true ); |
|
| 537 | update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date ); |
|
| 538 | } else { |
|
| 539 | //Set the name |
|
| 540 | if ( isset( $data[0]['name'] ) ) { |
|
| 541 | $post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ),$id, 'draft', 'accommodation', 0 ); |
|
| 542 | } |
|
| 543 | ||
| 544 | $post['post_name'] = $post_name; |
|
| 545 | $post['post_title'] = $data[0]['name']; |
|
| 546 | $post['post_status'] = 'publish'; |
|
| 547 | $id = wp_insert_post( $post ); |
|
| 548 | ||
| 549 | //Save the WETU ID and the Last date it was modified. |
|
| 550 | if ( false !== $id ) { |
|
| 551 | add_post_meta( $id,'lsx_wetu_id',$wetu_id ); |
|
| 552 | add_post_meta( $id,'lsx_wetu_modified_date',strtotime( $data[0]['last_modified'] ) ); |
|
| 553 | } |
|
| 554 | } |
|
| 555 | ||
| @@ 544-570 (lines=27) @@ | ||
| 541 | } |
|
| 542 | } |
|
| 543 | ||
| 544 | if ( false !== $id && '0' !== $id ) { |
|
| 545 | $post['ID'] = $id; |
|
| 546 | ||
| 547 | if ( isset( $data[0]['name'] ) ) { |
|
| 548 | $post['post_title'] = $data[0]['name']; |
|
| 549 | $post['post_status'] = 'publish'; |
|
| 550 | $post['post_name'] = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 ); |
|
| 551 | } |
|
| 552 | ||
| 553 | $id = wp_update_post( $post ); |
|
| 554 | $prev_date = get_post_meta( $id, 'lsx_wetu_modified_date', true ); |
|
| 555 | update_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ), $prev_date ); |
|
| 556 | } else { |
|
| 557 | //Set the name |
|
| 558 | if ( isset( $data[0]['name'] ) ) { |
|
| 559 | $post_name = wp_unique_post_slug( sanitize_title( $data[0]['name'] ), $id, 'draft', 'destination', 0 ); |
|
| 560 | } |
|
| 561 | ||
| 562 | $post['post_name'] = $post_name; |
|
| 563 | $post['post_title'] = $data[0]['name']; |
|
| 564 | $post['post_status'] = 'publish'; |
|
| 565 | $id = wp_insert_post( $post ); |
|
| 566 | ||
| 567 | //Save the WETU ID and the Last date it was modified. |
|
| 568 | if ( false !== $id ) { |
|
| 569 | add_post_meta( $id, 'lsx_wetu_id', $wetu_id ); |
|
| 570 | add_post_meta( $id, 'lsx_wetu_modified_date', strtotime( $data[0]['last_modified'] ) ); |
|
| 571 | } |
|
| 572 | } |
|
| 573 | ||