Opened 15 years ago
Closed 14 years ago
#11838 closed task (blessed) (fixed)
Add hierarchical taxonomies to the Menu bar
Reported by: | dd32 | Owned by: | dd32 |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
Along side the current Custom post types, I think we should expose custom hierarchical taxonomies as well finally.
I'll write a basic patch which exposes it, but some basic functionality may not work.
Attachments (8)
Change History (49)
#3
@
15 years ago
Looks good in general, although it causes come breakage in categories.php. All subcats are listed first, with top-level cats following.
#5
@
15 years ago
Turns out, That was the removal of the Output buffering.
Removal of the output buffer means that the function now returns instead of echo'ing, As cat_rows() should be called instead of _cat_rows() it should be safe to change that... see next patch
#6
@
15 years ago
Things to note:
- No Ajax still
- String like the following are.. how to handle them?
<p><?php printf(__('<strong>Note:</strong><br />Deleting a %1$s does not delete the objects in that %1$s. Instead, objects that were only assigned to the deleted %1$s are set to the %1$s <strong>%2$s</strong>.'), $tax->label, apply_filters('the_category', get_cat_name(get_option('default_' . $taxonomy)))) ?></p>
- Need Singular / Plural forms for all tax pages (This goes for posts too)
- "Category" needs to be removed and replaced with Taxonomy name
#7
@
15 years ago
- Default Category
- Deprecate the usage of it? See #11576
- Perhaps we should offer to set a default term ID on registration? or just allow for and option of default_<taxonomy> as i've done there?
#9
@
15 years ago
Just looking at this closely, I've got some huge worries about continuing to modify the category functions to pass a taxonomy.
I'm coming to the thought, of that perhaps, it'll be better to delete the categories.php file, and merge into a generic taxonomy terms page, specifically, tags.php for a start.
A lot of the category functionality is wraped in functions which wrap the taxonomy API, which makes it hard, as you're then only returning either "category"-specific errors, or preventing deleting the default term.
My suggestion is to move the default-deletion from the wrappers, into a hook of wp_delete_term, and merge the hierachial functionalities from categories.php into tags.php, or perhaps, into a new file terms.php as to stay reasonably filename-neutral.
Any feedback on that thought line?
Eg. Look at the category related functions in http://core.trac.wordpress.org/browser/trunk/wp-admin/includes/taxonomy.php combine that with get_category() and the compat code for categories.. I'd rather just deprecate the functions there and move to the taxonomy API directly or create a new set of neutral wrappers
#10
@
15 years ago
- Cc ShaneF added
+1 to this idea. Smaller is better and less files to find problems. This way we don't have to also double up code as well.
#11
@
15 years ago
(In [12818]) Merge Categories/Hierarchical taxonomies into edit-tags.php. See #11838
I've left all the category related files and ajax handlers in for now, Will clean them up afterwards assuming no issues.
A few changes were made in the merge, notably, the handling of searching and paging.
During searches, the hierarchy cannot be displayed 'correctly', child nodes will appear as childs of the incorrect term, and root nodes may duplicate as childs themselves.. Thats why i've disabled the hirachial display of them for now. - Related #11575
Paging: The final page may display more than per_page, due to the parent nodes being included in the listing. Its impossible to split these into extra pages due to the paging being determined before the category listing is created.
Strings: the entire taxonomy editing section needs new strings, to either make them generic (non tag/category) or to support them being specified. I'm thinking that 'edit_label', 'label_plural', 'new_label', etc may be needed upon taxonomy registration (Else, fall back to a generic string).
#12
@
15 years ago
- Owner changed from filosofo to dd32
- Status changed from new to accepted
- Type changed from defect (bug) to enhancement
#13
@
15 years ago
From #11575
@dd32
read ticket #11838
hard to show you screenshots on nightly build wordpress because categories admin page displays a left column with tags and a right column with categories. Waiting for the admin page to be more stable.
However i noticed the search form does not works properly as hierarchy is not respected !
#15
@
15 years ago
Need thoughts from translators/UI people for how to name things here i think.
At present there are a lot of strings in this interface which relate to Tags specifically, or Categories in the sense of the Parent interface.
I'm not sure if we could get away with a Singular_label and multiple_label fields and insert them into generic strings ("Add <singular_label>"), or if we'll be better allowing register_taxonomy()
to be passed a list of strings.. That has the downside that it'll not be translated for some languages.
A possibility is to go for a in-between, Allow plugins to specify the exact strings to be displayed, if not, fall back to a generic string which inserts the tax name. But that still goes back to the 90% of plugins which use it probably wont have the same translation count as WordPress does itself.
The strings which i'm thinking of would be Add a New Tag
, Add Tag
, Edit Tag
, Popular Tags
, Search Tags
#19
@
15 years ago
attachment 11838.crazy.translations.diff added
Thats my first attempt at giving the strings in the file a neutral tone, or one which works with multiple taxonomies.
I'm not 100% sure if having a Singular/plural form and statically inserting that into those strings is going to be a workable solution for translations, Can any translators comment on that?
This also has a let-down with the "Post Tags" label, which is only used in the Menu and the Meta box title. Everything else refers to it as "Tags" in paragraphs. With the addition of register_taxonomy_for_post_type()
it doesnt always mean it'll apply to only posts either - My vote would be to change it to simply "Tags" and "Tag"..
#21
@
15 years ago
Few things noticed:
- Not all of the sanitization of the terms was brought accross from categoeies
- As a result, Multiple categories with the same Name are allowed (they differ with slugs however).
- Everything appears working.
- See #8167
- As a result, Multiple categories with the same Name are allowed (they differ with slugs however).
- Quick edit doesnt handle Parents currently
- Never did.
- Probably best disabling that as while the parent can be updated, the row will not appear in the right location
- Quick edit throws a E_NOTICE when changing the slug to something that already exists
- You can create a Term in multiple Taxonomies
- Eg, "Test Category Tag" as a Category, If you then add it as a Tag, It'll recieve the same term_id (ie. it picks up the underlying term instead of creating a new one with a new slug)
#27
@
15 years ago
(In [13086]) Convert Terms page to use WP_Ajax_Response(), hierarchical terms will now appear under their parent OR have the parents prefixed, Terms will be removed from tag cloud/parent list upon deletion, Terms will be added to Parent list in correct order upon ajax creation, Errors on term creation flow back to UI, clean up _tag_row() alternate class handling, Show None text in Category dropdown if empty and show_if_empty = true. See #11838
#31
@
15 years ago
In [13077] I think it should read "An item ..." rather than "A item ..." on line 14 of trunk/wp-admin/edit-tag-form.php
#32
@
15 years ago
I think it should read "An item ..." rather than "A item ..."
Probably, Thanks for noticing :)
#38
@
15 years ago
- Cc jeff@… added
A couple of functions need to be adapted, or new functions added to cater to our hierarchical (and non-hierarchical) taxonomies, namely wp_list_categories() and its corresponding Walker_Category class. If you use either of these, you'll notice that they only generate links for categories (e.g. ?cat=12).
We need to alter wp_list_categories() to accept a 'taxonomy' argument (just as wp_dropdown_categories() has been adapted). Also, the Walker_Category class needs to use get_term_link() instead of get_category_link() for any term that is not a category.
#39
@
15 years ago
Those changes mostly look sane.
The only one i can see, is that get_term_link()
should be able to be used instead of get_category_link()
. no need for the if there.
A lot of hacking at the category functions there.. I think it might be better to just create a new generic functionset which does it.
A few things are needed in addition to this..
See also #10122 for adding the metaboxes to the edit pages.
This is designed as a first-scrape draft.