Tag Archives: query

Displaying Custom Post Types by Term

It’s documented, it’s used, but it wasn’t obvious to me. After hunting around, I finally found what I needed in the first place I looked: the WordPress Codex.

This is the wp_query argument needed to display posts assigned a particular term:

Using the term ID as a cat ID wasn’t working. I came across the above here, and used it in two simple loops to display the custom posts under category headers.

Want to display posts in a nested hierarchy? This goal led me to what is probably a cleaner solution. The following code is adapted fromĀ Hierarchical Category List with Post Titles, and blended with the code above.

It’s in action here under Sites