If you are looking for a way to list your WordPress custom post types by category, look no further! I was in the process of a redesign for a travel agent and need to create a custom post type for “travel Deals”, which then get broken down and listed by country. So, I set up the custom post type in my functions.php, built into it a taxonomy and was able to call the custom posts in my template. What I wasn’t able to easily figure out was how to sort the posts by listed categories.

Luckily, in my searching, I found a tutorial setup by Wes Bos which listed regular WordPress posts by category. I modified his code a bit and it now sorts custom post types by category as requested by my client. You can see my code in action here and feel free to use the code below on your projects!