get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC"); $categories = (array) $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories LEFT JOIN $wpdb->post2cat ON (category_id = cat_id) LEFT JOIN $wpdb->posts ON (post_id <=> id) $where GROUP BY cat_id"); function wxr_missing_parents($categories) { if ( !is_array($categories) || empty($categories) ) return array(); foreach ( $categories as $category ) $parents[$category->cat_ID] = $category->category_parent; $parents = array_unique(array_diff($parents, array_keys($parents))); if ( $zero = array_search('0', $parents) ) unset($parents[$zero]); return $parents; } while ( $parents = wxr_missing_parents($categories) ) { $found_parents = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories WHERE cat_ID IN (" . join(', ', $parents) . ")"); if ( is_array($found_parents) && count($found_parents) ) $categories = array_merge($categories, $found_parents); else break; } // Put them in order to be inserted with no child going before its parent $pass = 0; $passes = 1000 + count($categories); while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) { if ( $cat->category_parent == 0 || isset($cats[$cat->category_parent]) ) { $cats[$cat->cat_ID] = $cat; } else { $categories[] = $cat; } } unset($categories); function wxr_cdata($str) { if ( seems_utf8($str) == false ) $str = utf8_encode($str); // $str = ent2ncr(wp_specialchars($str)); $str = ""; return $str; } function wxr_cat_name($c) { if ( empty($c->cat_name) ) return; echo '' . wxr_cdata($c->cat_name) . ''; } function wxr_category_description($c) { if ( empty($c->category_description) ) return; echo '' . wxr_cdata($c->category_description) . ''; } print '\n"; ?> <?php bloginfo_rss('name'); ?> http://wordpress.org/?v= category_nicename; ?>category_parent ? $cats[$c->category_parent]->cat_name : ''; ?>posts_private ? '1' : '0'; ?>links_private ? '1' : '0'; ?> <?php the_title_rss() ?> post_content ?>]]> ID; ?> post_date; ?> post_date_gmt; ?> comment_status; ?> ping_status; ?> post_name; ?> post_status; ?> post_parent; ?> menu_order; ?> post_type; ?> get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID"); if ( $postmeta ) { ?> meta_key; ?> meta_value; ?> get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID"); if ( $comments ) { foreach ( $comments as $c ) { ?> comment_ID; ?> comment_author; ?> comment_author_email; ?> comment_author_url; ?> comment_author_IP; ?> comment_date; ?> comment_date_gmt; ?> comment_content; ?> comment_approved; ?> comment_type; ?> comment_parent; ?>