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

Custom Permalinks for Custom Post Types and Taxonomies

Here’s the method I use to get what you’re trying to achieve. First, register your location taxonomy: register_taxonomy( ‘location’, array( ‘business’ ), array( ‘rewrite’ => array( ‘slug’ => ‘business-location’ ) ) ); Next, register the business post type. The important bit to note here is the inclusion of the %location% rewrite tag in the slug. … Read more

Get current term’s ID

Here is a function I use to list subterms: /** * Lists all subentries of a taxonomy. * * @return void */ function ttt_get_subterms( $args = array () ) { if ( ! isset ( get_queried_object()->taxonomy ) ) { return; } $options = array ( ‘child_of’ => get_queried_object_id() , ‘echo’ => 0 , ‘taxonomy’ => … Read more