[wp-hackers] Hierarchical taxonomy post count
tcbarrett at gmail.com
Fri Dec 16 13:28:25 UTC 2011
I have 2 custom post types (e.g. product, brand), with a hierarchical
custom taxonomy (e.g. product type). I want to produce a drop down menu
(nested lists) of *available* products by product type for a particular
brand. The tricky bit that I can't see is how to do this nicely using
functions from the codex.
Here is a trivial example dataset:
Brands (2): Nike, Adidas
Products (2): "Nike's running shoes", "Nike's special shoe laces"
Product Types (6):
So under Adidas, I want to show nothing, under the Nike I want to show
==>"Nike's special shoe laces"
===>"Nike's running shoes"
So the ancestry implicitly accumulates the post count of the child terms.
The depth is unlikely to grow deeper than 4. Products have the brand as a
piece of meta.
Should I just start writing my own SQL or is there a nice way to do this
with WP_Query 'meta_query' + 'tax_query' ?
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
More information about the wp-hackers