Add Menu Order to Custom Post Type

Adjust the supports array of your Custom Post Type within functions.php to enable Menu Order filtering by adding ‘page-attributes’:

add_action( 'init', 'create_post_type' );

function create_post_type() {

 $labels = array(
 'name' => _x('Post Type', 'post type general name'),
 'singular_name' => _x('Post Type', 'post type singular name'),
 'add_new' => _x('Add New Post Type', 'Post Type'),
 'add_new_item' => __('Add New Post Type'),
 'edit_item' => __('Edit Post Type'),
 'new_item' => __('New Post Type'),
 'all_items' => __('All Post Types'),
 'view_item' => __('View Post Types'),
 'search_items' => __('Search Post Types'),
 'not_found' =>  __('No Post Types found'),
 'not_found_in_trash' => __('No Post Types found in Trash'), 
 'parent_item_colon' => '',
 'menu_name' => __('Post Types')

 );

 $args = array(
 'labels' => $labels,
 'public' => true,
 'publicly_queryable' => true,
 'show_ui' => true, 
 'show_in_menu' => true, 
 'query_var' => true,
 'rewrite' => true,
 'capability_type' => 'post',
 'has_archive' => true, 
 'hierarchical' => false,
 'menu_position' => null,
 'supports' => array( 'title', 'author', 'thumbnail', 'custom-fields', 'editor', 'revisions', 'page-attributes' ) // add 'page-attributes' within this array
 ); 

 register_post_type('my_custom_post_type',$args);

}



This will add the Attributes panel to the right sidebar of the full post view:

As well as to the All Posts view, when selecting “Quick Edit”:

Add Post Type Support to WooCommerce:

add_action( 'init', function(){
      add_post_type_support( 'product', 'page-attributes' );
});

Source.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.