WordPress.org

Ready to get started?Download WordPress

Forums

How can i combine these 2 "query_posts into one output? (3 posts)

  1. expat
    Member
    Posted 2 years ago #

    query_posts("showposts=$featured_num&cat=".get_cat_ID($featured_cat));

    query_posts(array
    ('post_type' => 'page',
    'orderby' => 'menu_order',
    'order' => 'ASC',
    'post__in' => (array) get_option('feat_pages'),
    'showposts' => (int) $featured_num
    ));

    How can i combine these 2 "query_posts into one output?

  2. Oleg Dudkin
    Member
    Posted 2 years ago #

    Hi,
    I think the best option is to combine query results after query was made.
    E.g.

    global $wp_query;
    
    query_posts("showposts=$featured_num&cat=".get_cat_ID($featured_cat));
    $_t1  = $wp_query->posts;
    
    query_posts(array
    ('post_type' => 'page',
    'orderby' => 'menu_order',
    'order' => 'ASC',
    'post__in' => (array) get_option('feat_pages'),
    'showposts' => (int) $featured_num
    )); 
    
    $wp_query->posts = array_merge( $_t1, $wp_query->posts );
    $wp_query->post_count = count($wp_query->posts);
    
    // main loop here

    I haven't tested this, but code should do the trick.

  3. expat
    Member
    Posted 2 years ago #

    thanks, i give it a shot and see how i can do ;)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags