I'm working with a custom post type with custom taxonomy and custom fields and trying to filter the displayed results (on admin post listing page) by the custom field values...
I've been trying to modify a function i found here to do the job to no avail:
function wpg_filter_manage_quotes() {
global $typenow;
if($typenow != 'quotes') {
return;
}
$post_types = get_post_types(array( '_builtin' => false));
if(in_array($typenow, $post_types)) {
$filters = get_object_taxonomies($typenow);
foreach($filters as $tax_slug) {
$tax_obj = get_taxonomy( $tax_slug );
wp_dropdown_categories( array(
'show_option_all' => __('Show All '.$tax_obj->label ),
'taxonomy' => $tax_slug,
'name' => $tax_obj->name,
'orderby' => 'name',
'selected' => $_GET[$tax_slug],
'hierarchical' => $tax_obj->hierarchical,
'show_count' => false,
'hide_empty' => true
));
}
}
}
add_action('restrict_manage_posts', 'wpg_filter_manage_quotes');
The above function works as it should to add a dropdown to filter by custom taxonomy, but for the life of me I can't figure out how to modify it to work with custom field data...
I'm wanting to add a dropdown to filter by Author as well, and the author is stored as a custom field value. I've also got a list of all authors currently being used in my options array in the database... It's stored as an array in a variable like so: $wpgqs['used_authors']
.
Any ideas?
EDIT:
The more I look at it, the more I think I'm going to have to hardcode the selectbox... If that's the case, then I guess I just need to know which filters/hooks I need to be using to add the hardcoded selectobx to that particular submit button's form?