There are many great code snippets in their Gitlab. You might find more on their…
Add Column to CPT with the menu_order value of a post
In this example, I used a „portfolio“ CPT. Change as needed.
/** * add order column to admin listing screen for header text */ function add_new_portfolio_column($portfolio_columns) { $portfolio_columns['menu_order'] = "Order"; return $portfolio_columns; } add_action('manage_portfolio_posts_columns', 'add_new_portfolio_column'); /** * show custom order column values */ function show_order_column($name){ global $post; switch ($name) { case 'menu_order': $order = $post->menu_order; echo $order; break; default: break; } } add_action('manage_portfolio_posts_custom_column','show_order_column'); /** * make column sortable */ function order_column_register_sortable($columns){ $columns['menu_order'] = 'menu_order'; return $columns; } add_filter('manage_edit-portfolio_sortable_columns','order_column_register_sortable');
Dieser Beitrag hat 0 Kommentare