WordPress.org

Ready to get started?Download WordPress

Forums

Problem with ORDER BY in wp_query (4 posts)

  1. Rafalii
    Member
    Posted 1 year ago #

    Hi
    I'm looking for solution for a long time but I can't find it - maybe you can help..

    My query is:

    $qq = new WP_Query(array(
    		'post__in' => array(940, 939, 941),'showposts' => 4, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'post_type' => array( 'post', 'portfolioentry')
    		));

    I'm trying to display posts in post id order: 940, 939, 941.

    I'm trying to use meta_vaue_num [http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters] but without success.

    Please help. Thanks in advance!
    Rafal

  2. keesiemeijer
    moderator
    Posted 1 year ago #

    With WordPress 3.5 the order of the array is respected, until then you'll need a plugin: http://wordpress.org/extend/plugins/sort-query-by-post-in/

  3. Rafalii
    Member
    Posted 1 year ago #

    It works - I didn't thought there's plugin for it ;)
    Thanks keesiemeijer!

  4. keesiemeijer
    moderator
    Posted 1 year ago #

    No problem :-)

Topic Closed

This topic has been closed to new replies.

About this Topic