#14497 closed enhancement (wontfix)
Relate a taxonomy to a post type on menus
Reported by: | vteixeira | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Menus | Keywords: | |
Focuses: | Cc: |
Description
I was trying to create a simple functionality on a site I'm building right now and just noticed that this is not possible.
The functionality needed:
1- To actually add a post type as a menu item. (!important)
2- To relate a taxonomy item to a post type on the menu (!more important)
The problem I'm facing:
Imagine I have a post type called Schools and another called Shops.
Then I have a taxonomy called Cities that is enabled for both post types.
I want to have a menu like this:
-Schools
--New York
--Washington
--Los Angeles
-Shops
--New York
--Washington
--Los Angeles
The first problem is that I can't add a post type as a menu item (could get something like this just by adding a custom item - then another problem is that there's no archives for post types...)
The second problem is that there's no way of referencing the taxonomy items to the post types!
So each city that is child of a post type (on the menu) will display both post types posts - there's no way to filter this on the menu right now.
I think this is basic menu building functionality. This should be in core.
Of course I can have two taxonomies like school-cities and shop-cities but this is weird and really strange and I would not be able to relate the different post types by city... Not a viable solution.
Things really gets more difficult when I need to build a post type called Cities to be able to create a page with information for each city and then relate this to the cities taxonomy.
If this is already requested on another ticket please close, but if not I need your thoughts on this.
Change History (5)
#1
@
14 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
#2
@
14 years ago
OK, so how can I build the example menu with custom menu items right now?
mydomain.com/schools/new-york/ or mydomain.com/schools/cities/new-york/ or mydomain.com/cities/new-york/schools/
I don't think any of this works...
So I think there's no way to filter taxonomies by post type.
#3
@
14 years ago
So I think there's no way to filter taxonomies by post type.
Yes there is, only it's not pretty:
example.com/?school=X&post_type=Y
Of course, with a little rewrite hackery, you can get mydomain.com/schools/cities/new-york/ to work too.
I'm not confortable enough with the rewrite system to give you a concrete solution, but I'm sure one exists.
#4
@
14 years ago
Shouldn't this be a good feature request for a future version of WordPress?
To filter taxonomies by post type on the rewrite side of things.
I really think this is the kind of behavior that most people expect. Not advanced functionality.
On my understanding this can be pretty easy: if a taxonomy appears after the post type on the url, then it gets filtered by it.
Just my thoughts... And thanks for the reply.
And I really
I disagree. The fact that you can add custom menu items guarantees that you can make any menu imaginable.
Having a distinct menu item type restricted to a taxonomy and a post type is very specific and could be provided by a plugin.
All the rest of the problems you mention should be dealt with in separate tickets.