Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In a site I have registered some custom taxonomies.
I want to have sort of a linkage between one of the custom taxonomies and the categories (which is, also, a taxonomy by itself), in such a way:
If the admin assigns a post to category A - so he will be able to choose to associate with that post only specific terms of the custom taxonomy.
If the user assigns a post to category B - then he will be able to choose only other terms set from that custom taxonomy, and so on..

Each custom taxonomy term would be 'associated' with only one category.

Two ways in which I do not want to implement it - I don't want to use sub-categories for this, but to use a different taxonomy.
Also, I don't want to register some different taxonomies and each them to put the terms that fit each category.

The only way I could think of now, is to add a custom field to each term of the custom taxonomy. This field will be selected in the admin, for example, through a select box to avoid mistakes.
Then in the post editing screen, instead of showing the regular default metabox of adding terms of a taxonomy (which is like adding tags) - so to remove it and add a custom metabox, where relevant terms are selectable by the selected category.

Of course, in that case the editor would have to first save a draft after choosing a category, to let the system know what terms to pull of the custom taxonomy (or, make ann Ajax call after each checkbox check, to reload the list of possible terms to choose according to the category selected).

I'm not sure this is the best way, but it's only now I think ...

I would love to brainstorm ideas of this issue.

Thanks a lot, Maor

share|improve this question
    
Why not sub-categories? Sounds like it would fit your other requirements perfectly. Also can you please explain your use case rather than discuss in abstract terms? We can more easily help you if we can better understand what you are trying to do. –  MikeSchinkel Jan 25 '11 at 3:38
    
There are channels (categories) and subjects (the other taxonomy). Each channel has separate subjects associated, and is needed to be both separated by name in the front end and also in the admin. The admin should see "subjects" as a separate meta box and not as "sub channels" –  Maor Barazany Jan 25 '11 at 19:42

1 Answer 1

@Maor Barazany - Glad you joined this site.

I think adding a custom field to your taxonomy witch is in the form of select tag so each one of your taxonomy terms is linked to a category is the best way to create that relationships.

Then on your meta box create a dropdown of you categories with an OnChange event function to show the taxonomy terms related to that category all in JQuery or plain JavaScript without the ajax part.

in that way once the user selects a category from the dropdown the list of taxonomy terms will change according to that category, and there is no need to save a draft for that.

Basically what I'm suggesting is to generate all of the relations on the meta box display function so you won't need to create any ajax calls.

hope's this makes any sense.

share|improve this answer
    
Thanks for your answer. I don't mind doing it with ajax, I already use some ajax in the admin panel for something else, it's not that important if the change will make ajax call to load the appropriate terms related to the category or if it will be just show/hide it with js. The question if this is the right method, since it might be that I would like to keep the way of the tags style of selecting terms etc. –  Maor Barazany Jan 25 '11 at 19:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.