#19757 closed defect (bug) (wontfix)
the_category() should include depth
Reported by: | jordash56 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
I've noticed a lot of category functions don't have depth attributes built into them.
The default usage of the_category() results in poorly formatted category listings for more complicated category structures (using Wordpress as a CMS).
Here's an example: http://bestappsrated.com/android-apps/
If you look at some of the post listings, you'll notice each category is duplicated, that's because their is 3 levels (depth) to that post.
If there was a depth option for the the_category()
for example allowing: the_category(', ', 'depth=2')
It would completely circumvent that problem, And allow a huge amount of flexibility and greater use of Categories withing wordpress, without forcing themer writing custom loops and for statements.
Here's another article where there's frustration that this function (and similar category functions) doesn't have a depth parameter: http://www.wpbeginner.com/wp-themes/how-to-display-only-parent-category-in-your-wordpress-post-loop/
Change History (5)
#1
@
12 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
#2
@
12 years ago
Actually, I see what you mean. Still, a better solution would be to define multiple taxonomies:
Platform: - iPhone - Android Game type: - RPG - shooter
This way, you don't have to create duplicate terms.
#3
@
12 years ago
Oh yeah you're right, that would be much better. And I realized, with 3 depths to the categories, there would still be duplicates even if depth was included in the_category.
I think i'll give the plugin: http://wordpress.org/extend/plugins/simple-taxonomies/installation/ that you recommend a try.
Thanks
#5
@
12 years ago
Do you have any examples of the functions to generate lists and trees? Sounds Interesting.
I like the taxonomy method now, it's a lot more flexible, I applied it to pages like this:
http://bestappsrated.com/os/iphone/
It's not quite perfect though, the only way I could figure out how to do combined filters was with Scribus Multi Query plugin, it's almost perfect, I can do search terms like this:
http://bestappsrated.com/apptype/productivity/?os=iPhone
But it's not fully search engine friendly in the URL, and it requires some custom way to program to get it easier for the user to navigate and take advantage of the filters. (Mainly a way to keep the query strings right).
I think Wordpress is definitely in the right direction in the Taxonomy methods, Drupal has some stuff like this built in and Wordpress is already almost better in that arena. (Plus wordpress is way better at everything else).
From the looks of it, it seems that you have that post assigned to the parent categories as well, which is not necessary.
Assign it only to the leaf categories and the problem goes away.