How to List All Posts in a Custom Taxonomy Separated by Terms

In this post I will demonstrate how to list all posts from a specific custom taxonomy, separated by its terms. In this example, we will use “movie” as custom post type, “genre” as custom taxonomy, and the terms for this taxonomy: “Action”, “Comedy”, and “Drama.” The loop will output something like this:

Action

Fast & Furious 6
Skyfall
The Avengers

Comedy

Superbad
The Hangover
Ted

Drama

Flight
The Notebook
The Shawshank Redemption

Note: each movie title represents a “movie” custom post.

The Loop

I hope this helps you on your next WordPress project that uses custom post types and custom taxonomies.

Posted in WordPressTagged , 10 Comments

Ready to get started?

Get a Free Estimate