WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to sort pages in the loop using the admin's order field (under page attributes)?

share|improve this question
up vote 9 down vote accepted

Yes, use the orderby clause in your query posts.

query_posts( array('orderby'=>'menu_order' ) );

See: http://codex.wordpress.org/Function_Reference/WP_Query#Order_.26_Orderby_Parameters for reference

share|improve this answer
    
Awesome - thank you! – Ryan Mar 9 '11 at 0:25
1  
Please note that you also need to use order argument, example: 'order' => 'ASC'. – Souvlaki Dec 29 '15 at 18:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.