• I want to retrieve a custom set of pages and sort them manually (in the post__in order)

    my code is:

    query_posts(array(
    'post__in'=>array('16','20','22'),
    'post_type'=>'page',
    'order' => 'post__in'
    ));
    
    if ( have_posts() ) while ( have_posts() ) : the_post();
    	the_title();
     endwhile;

    But the output is the titles ordered by date.
    I am using the 'order' => 'post__in' as used in this article.

Viewing 3 replies - 1 through 3 (of 3 total)
  • as far as i can read, that article uses:

    'orderby' => 'post__in'

    it also assumes that you have activated that plugin.

    Thread Starter odyodyodys

    (@odyodyodys)

    Thanks alchymyth, I am using the plugin at the moment. My question was more about the wordpress core. If I can have that result without using a third party plugin.
    I want just to display posts in a specified order.
    I could do multiple loops using WPquery but this is a funny solution 🙂

    This page has all the available options you can pass into ‘orderby’ without using any plugin. Perhaps one of them is what you’re looking for?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘How do I sort posts by post__in ?’ is closed to new replies.