I added 'supports' => 'page-attributes'
to my custom post type, and now i have the meta box for page ordering.
When i use the argument 'sort_column' => 'menu_order'
with get_pages()
on my custom post type, everything orders properly.
So why do the custom pages not order properly when i query the posts using query_posts(array('orderby' => 'menu_order'))
And what can i do to get them to order by the menu order?
Here is the query im using incase anyone wants to see it.
<?php
$current_term = ($wp_query->query_vars['section'] <> '') ? $wp_query->query_vars['section'] : $menu_arr[0];
query_posts(array( 'post_type' => 'module',
'orderby' => 'menu_order',
'tax_query' => array(array( 'taxonomy' => 'section',
'field' => 'slug',
'terms' => $current_term )),
'post_parent' => 0 ));
?>
I’ve just had to do the same thing as you, here is what I did to get this working:
'supports' => array('title', 'editor', 'thumbnail', 'page-attributes')
Register the post type with supports of page attributes. This adds the menu order meta box to the edit screen. From there you can place the order.
Then run my custom query:
set
orderby
to menu_order andorder
to ASC. Remember if you do not set a value in menu order it sets it to 0. So any posts without an order set will appear first.in my functions.php i used this:
and in my theme that:
This is what worked for me
Bye
sort_column=menu_order
only sorts pages based on their order in writing not the order you set inview > menus
(translated), if you want that you can do like this: