taxonomy filter not working
-
I have the following code of taxonomy and i want to filter by this taxonomy this is my taxonomy code
function create_book_taxonomies() {
// Add new taxonomy, make it hierarchical (like categories)
$labels = array(
‘name’ => _x( ‘Project Types’, ‘taxonomy general name’ ),
‘singular_name’ => _x( ‘Project Type’, ‘taxonomy singular name’ ),
‘search_items’ => __( ‘Search Project Type’ ),
‘all_items’ => __( ‘All Project Types’ ),
‘parent_item’ => __( ‘Parent Project Type’ ),
‘parent_item_colon’ => __( ‘Parent Project Type:’ ),
‘edit_item’ => __( ‘Edit Project Type’ ),
‘update_item’ => __( ‘Update Project Type’ ),
‘add_new_item’ => __( ‘Add New Project Type’ ),
‘new_item_name’ => __( ‘New Project Type Name’ ),
‘menu_name’ => __( ‘Project Type’ ),
);$args = array(
‘hierarchical’ => true,
‘labels’ => $labels,
‘show_ui’ => true,
‘show_admin_column’ => true,
‘query_var’ => true,
‘rewrite’ => array( ‘slug’ => ‘project-type’ ),
);register_taxonomy( ‘genre’, array( ‘portfolio’ ), $args );
}and this is wp_query code
if($posttype = ‘All’ or $posttype=”){
$wp_query->query(‘showposts=9&offset=’.$start_from.’&paged=’.$paged.’&post_type=portfolio&post_status = publish’);
}else{
$wp_query->query(‘showposts=9&offset=’.$start_from.’&post_type=portfolio&taxonomy=’.$posttype.’&paged=’.$paged.’&post_status = publish’);
}
- The topic ‘taxonomy filter not working’ is closed to new replies.