/* overwrite drop down select by category
-----------------------------------------*/
add_action('restrict_manage_posts','overwrite_listings_by_category');
function overwrite_listings_by_category() {
global $typenow;
global $wp_query;
if ($typenow=='post') {
$taxonomy = 'category';
$category_taxonomy = get_taxonomy($taxonomy);
//return print_r($wp_query->query);
return wp_dropdown_categories(array(
'show_option_all' => __("Show All {$category_taxonomy->label}"),
'taxonomy' => $taxonomy,
'name' => 'cat',
'orderby' => 'name',
'selected' => @$wp_query->query['cat'],
'hierarchical' => true,
'depth' => 5,
'show_count' => true, // Show # listings in parens
'hide_empty' => true, // Don't show businesses w/o listings
));
}
}
The Screenshots:
...let's check out some screen shots for the finished product:
Listings list page with No Filtering:
Listings list page With Filtering: