Support » Fixing WordPress » displaying posts using the order attribute

  • I have a custom post type which includes the ‘Order’ attribute. I’ve searched for a solution to get WP to actually use the ‘order’ value to display the posts (by default they are displayed in date order).

    I can see from the codex that I need to add the following to my loop:
    query_posts( array('orderby'=>'menu_order' ) );

    But unfortunately I just can’t get it working. I’m using a modified loop from Twenty Ten theme. Where exactly should I be placing the above code?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Dash10

    (@justingreerbbi)

    Forum Moderator

    You have to tell it how to order as well;

    query_posts( array('orderby'=>'menu_order','order'=>'ASC' ) );

    Thanks justingreerbbi but I still can’t get it working. Where exactly in the loop should the code go?

    this is driving me insane – no matter what I do I can’t get it working. I can’t get the posts to display via their order attribute, nor (as an alternative) can I get them to display by date, with oldest at top. Nothing works.

    …anyone?

    By putting this in my category template just before the loop, I can now get posts to display using the order attribute:

    query_posts( array('orderby'=>'menu_order','order'=>'ASC' ) );

    BUT – it displays the entire posts instead of just the excerpts. How do I get the excerpts back???

    Finally, fixed it!

    I changed some code in the loop, enabling me to display excerpts when using query_posts

    I changed the following within the “entry-content” div:

    <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'BTC' ) ); ?>

    replaced with:

    <?php the_excerpt(); ?>

    (please note I’m using a blank theme from blankthemes.com/ so your loop may differ).

    I really hope my hours of trial and error can be of benefit to others here.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘displaying posts using the order attribute’ is closed to new replies.