Query Multiple Taxonomies

Query Multiple Taxonomies: Version 1.6

The major new feature in this release is the long awaited checkbox mode:

As a bonus feature, there’s now a `` template tag which will display the number of items for that term. This was contributed by khakulov. For a usage example, see templates/list-item.html.

Query Multiple Taxonomies: Version 1.5

Better titles

If you go to an URL like ?genre=jazz&instrument=guitar+piano, the page title that WP serves looks like this:

Jazz

Not very descriptive, is it? With QMT, it looks like this:

Genre: Jazz; Instrument: Guitar + Piano

Easy templating

It was painful seeing users modify the plugin PHP files, just to change from <h4> to <h3> or to add an id to some div. No more.

In this version, all the HTML is separated into distinct files, which can be overwritten by themes. Here’s a guide for doing that.

Remember the tutorial for customizing category walkers, which involved writing your own PHP class and a helper function on top? What if you could do it without writing any PHP at all?

<li class="term-item current-term">
  
  		<a class="remove-term" href="" title=""> (-)</a>
  	
  	
  		<a class="add-term" href="" title=""> (+)</a>
  	
  	
  		<ul>
    }
    		
  </ul>
  	
  
</li>

This is the default Mustache template that is used by the plugin to generate a hierarchical list of terms.

I’m really excited about using Mustache in WordPress, as it neatly fills the gap between providing a settings page and making the user write PHP code.

Query Multiple Taxonomies: Version 1.4

I’m happy to announce that the ability to query multiple taxonomies is in WordPress Core, as of version 3.1.

However, there still is no ability to make use of that feature without writing at least a few lines of code.

So, the focus of this plugin will be shifting from enhancing WP’s taxonomy querying capabilities to providing an awesome user interface for them.

Besides several bugfixes, with version 1.4 you can now choose the order in which the taxonomies appear in the drill-down widget, by simply dragging them up and down.

Query Multiple Taxonomies: Version 1.3

The latest version of the plugin brings a new ‘dropdowns’ mode to the Taxonomy Drill Down widget. I’ve also added a few filters so you can further customize the appearance, without modifying plugin files. They can be found in query-multiple-taxonomies/widget.php.

new widget interface

Also, a single widget handles multiple taxonomies now. Hovering over a taxonomy will show you the post types it’s associated with.

If you’re currently using an older version, you will have to re-add the widget after upgrading.

On the template side of things, all taxonomy archives (multiple or not), now go to taxonomy.php, instead of multitax.php. Also, is_multitax() now accepts an array of taxonomy names to check against:

if ( is_multitax( array( 'colour', 'shape' ) ) ) {
  // Both the colour and shape taxonomies were queried
}

Last but not least, the plugin has been better integrated with the WP_Query class, fixing a number of bugs in the process. For example, besides query_posts(), you can also use new WP_Query(...) now.

Query Multiple Taxonomies: Version 1.2

Fewer queries

Instead of doing a separate query for each taxonomy, the plugin now does a single combined query, using a proposed API.

Custom Post Type Support

Custom post types go very well with custom taxonomies, so the Taxonomy Drill-Down widget now has a post type dropdown.

Correct Template

This version doesn’t mess with category and tag templates anymore. In earlier versions, when you would go to /category/example, it would attempt to load the multitax.php template file, instead of category.php etc.

Query Multiple Taxonomies: Version 1.1

This version finally brings something you can sink your teeth into, so to speak. I’m talking about the new taxonomy drill-down widget:

drill-down navigation

As you might notice from the screenshot, it works with hierarchical taxonomies too and lets you do queries like this:

?ingredients=flour+sugar&flavour=sweet

I would like to thank Matthew Porter for coming with the initiative and for sponsoring this release.

Query Multiple Taxonomies: Version 1.0

Say you have two custom taxnomies defined: genre and artist.

Currently, you can do the following types of queries on your site:

?genre=jazz

?genre=jazz&#038;cat=1

But you can’t do this:

?genre=jazz&#038;artist=chet-baker

WordPress will just ignore one of the parameters.

This plugin fixes that.