WordPress.org

Ready to get started?Download WordPress

Forums

Select posts of onyl one category (4 posts)

  1. csseur3
    Member
    Posted 5 years ago #

    Hi,
    in this query (of the xml export function):

    <?php if ($post_ids) {
              global $wp_query;
              $wp_query->in_the_loop = true;  // Fake being in the loop.
              // fetch 20 posts at a time rather than loading the entire table into memory
              while ( $next_posts = array_splice($post_ids, 0, 20) ) {
                $where = "WHERE ID IN (".join(',', $next_posts).")";
                $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
                  foreach ($posts as $post) {
                setup_postdata($post); ?>

    how to select only posts of the category who have the ID=3 ?

    ++

  2. csseur3
    Member
    Posted 5 years ago #

    I try to add query_posts("cat=3"); before the while, but nothing is changed :(

    help me please :)

  3. csseur3
    Member
    Posted 5 years ago #

    nobody? :(

  4. csseur3
    Member
    Posted 5 years ago #

    up

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.