Sort custom post-types by taxonomy…
-
Custom post types are great but, unless I’m missing something, it seems that, by default, they aren’t sortable by taxonomy at all.
I think this is relatively simple and should probably be part of the most basic core functionality of the custom post type API.
Here’s a simple scenario:
I’m creating an exchange site with 2 custom post-types: ‘Listings’ and ‘Requests’ both are essentially the exact same thing and can easily share the ‘Category’ taxonomy but they will need to be sorted separately – as someone who is looking at ‘Furniture’ listings will not be interested in ‘Furniture’ requests.So, let’s say I just use the existing ‘Post’ post-type for ‘Listings’ and create a few categories like ‘Electronics’ and ‘Furniture’. Great, that’s easy enough. Now people can browse ‘Furniture’ listings without having to look at ‘Requests.’
So that’s good and I proceed to create a custom post-type for Requests and allow it to use the ‘Category’ taxonomy. I can create Requests, just like Listings(Posts) and categorize them as ‘Furniture’ but I can’t sort Requests by ‘Furniture’ the same way I could with Listings. (Booo!)
Basically, I would like to configure everything so that
domain/post-type/taxonomy-item
would return the expected results in the typical blog style layout. Ex:mysite.com/listings/furniture mysite.com/listings/electronics mysite.com/requests/furniture mysite.com/requests/electronics
Creating individual queries and pages based on taxonomy items is obviously off the table as there could end up being dozens of categories and it wouldn’t be maintainable.
Has anyone else run in to this issue? Do you know of any sites that are currently utilizing any solutions? and, of course, can you help me?
- The topic ‘Sort custom post-types by taxonomy…’ is closed to new replies.