I have a special case where I'd like to order posts in a custom order and it would be great to use the "menu_order" field that is normally only used for pages. What would be the best way to expose that in the WordPress admin UI?
1 Answer
Apparently it's as easy as:
add_action( 'admin_init', 'posts_order_wpse_91866' );
function posts_order_wpse_91866()
{
add_post_type_support( 'post', 'page-attributes' );
}
And then doing the query:
$order_posts = new WP_Query(array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'menu_order',
'order' => 'ASC',
) );
-
Glad I asked. I was thinking I'd need to add a custom meta box and just save to the posts table manually.– tooshelCommented Mar 25, 2013 at 16:57
-
Apparently, this doesn't work with Gutenberg. Here is an updated version that works: gist.github.com/chrisguitarguy/1301501 Commented Mar 6, 2019 at 0:17
-