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
This commit is contained in:
westi 2009-08-04 21:46:42 +00:00
parent d26e048b4c
commit d74205ae0a
2 changed files with 12 additions and 1 deletions

View File

@ -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 <em>%s</em>...'), 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 ) )

View File

@ -268,7 +268,13 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\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;
?>
<item>
<title><?php echo apply_filters('the_title_rss', $post->post_title); ?></title>
<link><?php the_permalink_rss() ?></link>
@ -291,6 +297,7 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
<wp:post_password><?php echo $post->post_password; ?></wp:post_password>
<wp:is_sticky><?php echo $is_sticky; ?></wp:is_sticky>
<?php
if ($post->post_type == 'attachment') { ?>
<wp:attachment_url><?php echo wp_get_attachment_url($post->ID); ?></wp:attachment_url>