Created
March 14, 2012 00:23
-
-
Save nicolechung/2032931 to your computer and use it in GitHub Desktop.
Wordpress: sort admin columns for a custom post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('restrict_manage_posts','restrict_menu_post'); | |
function restrict_menu_post() { | |
global $typenow; | |
global $wp_query; | |
if ($typenow=='menu') { | |
$taxonomy = 'menutype'; | |
$menu_taxonomy = get_taxonomy($taxonomy); | |
wp_dropdown_categories(array( | |
'show_option_all' => __("Show All {$menu_taxonomy->label}"), | |
'taxonomy' => $taxonomy, | |
'name' => 'Menu', | |
'orderby' => 'name', | |
'selected' => $wp_query->query['term'], | |
'hierarchical' => false, | |
'depth' => 3, | |
'show_count' => true, // Show # listings in parens | |
'hide_empty' => false, // Don't show menu types w/o listings | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment