From d74205ae0a6ee279b8449356ced8bc03a4b2c195 Mon Sep 17 00:00:00 2001 From: westi Date: Tue, 4 Aug 2009 21:46:42 +0000 Subject: [PATCH] Add support for sticky posts to the WXR exporter and importer. Fixes #10462 props josephscott. git-svn-id: http://svn.automattic.com/wordpress/trunk@11774 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/import/wordpress.php | 4 ++++ wp-admin/includes/export.php | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php index 99903487f7..b6c4d960e5 100644 --- a/wp-admin/import/wordpress.php +++ b/wp-admin/import/wordpress.php @@ -378,6 +378,7 @@ class WP_Import { $menu_order = $this->get_tag( $post, 'wp:menu_order' ); $post_type = $this->get_tag( $post, 'wp:post_type' ); $post_password = $this->get_tag( $post, 'wp:post_password' ); + $is_sticky = $this->get_tag( $post, 'wp:is_sticky' ); $guid = $this->get_tag( $post, 'guid' ); $post_author = $this->get_tag( $post, 'dc:creator' ); @@ -448,6 +449,9 @@ class WP_Import { else { printf(__('Importing post %s...'), stripslashes($post_title)); $comment_post_ID = $post_id = wp_insert_post($postdata); + if ( $post_id && $is_sticky == 1 ) + stick_post( $post_id ); + } if ( is_wp_error( $post_id ) ) diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php index 641e173881..2b0d839059 100644 --- a/wp-admin/includes/export.php +++ b/wp-admin/includes/export.php @@ -268,7 +268,13 @@ echo '\n"; // Don't export revisions. They bloat the export. if ( 'revision' == $post->post_type ) continue; - setup_postdata($post); ?> + setup_postdata($post); + + $is_sticky = 0; + if ( is_sticky( $post->ID ) ) + $is_sticky = 1; + +?> <?php echo apply_filters('the_title_rss', $post->post_title); ?> @@ -291,6 +297,7 @@ echo '\n"; menu_order; ?> post_type; ?> post_password; ?> + post_type == 'attachment') { ?> ID); ?>