Categories under custom post types doesn’t show properly

Categories and Taxonomies are not exactly the same. A category is a default taxonomy You can use categories with custom post types however its better to use custom taxonomies because the truth is, they are an extremely powerful way to group various items in all sorts of ways. add_action( ‘init’, ‘wpsites_custom_taxonomy_types’ ); function wpsites_custom_taxonomy_types() { … Read more

Showing current taxonomy terms

try this: <?php get_header(); ?> <? // get the current term $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); <div class=”container” role=”main”> <h1 class=”entry-title”><?php echo $term->name; ?></h1> <div class=”entry-content ref”> <?php $loop = new WP_Query( array( ‘post_type’ => ‘references’ , ‘genre’ => $term->slug) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); … Read more

how to group custom post type posts by custom taxonomy terms

try using this fancy function that group the posts by term id that Scribu and Mike created: function event_clauses( $clauses, $wp_query ) { global $wpdb; if ( isset( $wp_query->query[‘orderby’] ) && ‘event_location’ == $wp_query->query[‘orderby’] ) { $clauses[‘join’] .=<<<SQL LEFT OUTER JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID={$wpdb->term_relationships}.object_id LEFT OUTER JOIN {$wpdb->term_taxonomy} USING (term_taxonomy_id) LEFT OUTER JOIN {$wpdb->terms} USING … Read more

Custom Post Type / Taxonomy Slug / Post Title with post type archive

Replace your code with the following. I have made some changes to the post_type_link filter’s callback function. function my_custom_post_work() { $labels = array( ‘name’ => _x( ‘Work’, ‘post type general name’ ), ‘singular_name’ => _x( ‘Work’, ‘post type singular name’ ), ‘add_new’ => _x( ‘Add New’, ‘book’ ), ‘add_new_item’ => __( ‘Add New Work’ ), … Read more