Timeline for How to determine the depth of a term in a custom taxonomy?
Current License: CC BY-SA 3.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 16, 2013 at 12:58 | comment | added | unfulvio | I just realized that the options in the dropdown have a class assigned based on the depth. One could make some css rules to insert a padding for subcategories (which are .level-1 or higher number). | |
Jan 16, 2013 at 12:46 | vote | accept | unfulvio | ||
Jan 16, 2013 at 11:37 | comment | added | Mike Madern |
The normal category permalink structure is indeed /?cat=1 , have you tried to display the category by displaying one trough the category menu?
|
|
Jan 16, 2013 at 11:31 | comment | added | Mike Madern | That definitely is an option, I probably should do the same thing now. Still wondering why there is no such option, it seems like a essential functionality since (i guess) most of the WordPress websites use Pretty Permalinks. | |
Jan 16, 2013 at 11:31 | comment | added | unfulvio | what would be the way to perform a taxonomy query without permalinks? I tried myurl.com/?cat=<term_id> or myurl.com/?<taxonomy_name>=<term_id> they both return 404... | |
Jan 16, 2013 at 11:23 | comment | added | unfulvio | yeah I got stuck there too... there's a thing like Walker_CategoryDropdown, which is invoked by walk_category_dropdown_tree() which is inside wp_dropdown_categories().... too bad that the latter doesn't take an argument for a custom walker so one would have to rewrite everything just to pass a custom walker, doesn't seem logical to me. On the other hand what the other option would be? Store wp_dropdown_categories() into a variable and do a regex to alter the option contents? | |
Jan 16, 2013 at 8:04 | comment | added | Mike Madern |
It should work with custom taxonomy because there is a taxonomy argument you can provide. I tried to search for any clear code wich would explain where the url is build but I get stuck on WP_Walker.
|
|
Jan 15, 2013 at 17:06 | comment | added | unfulvio | there is some method descriped in codex.wordpress.org/Function_Reference/wp_dropdown_categories but URLs created with those methods will return 404 if one uses pretty permalinks, URL rewrites seem not to correct the problem (or maybe they work with blog posts only? in my case is a custom taxonomy) | |
Jan 15, 2013 at 16:16 | vote | accept | unfulvio | ||
Jan 15, 2013 at 16:39 | |||||
Jan 15, 2013 at 13:59 | comment | added | Mike Madern | But basically, your question has been answered? It would be nice if you could do the job with javascript. | |
Jan 15, 2013 at 13:55 | comment | added | unfulvio | or even more practically, I could do this with javascript, just found a valid example in codex codex.wordpress.org/Function_Reference/wp_dropdown_categories - apparently wp_dropdown_categories doesn't accept a custom walker in the args | |
Jan 15, 2013 at 13:41 | comment | added | unfulvio | uh... just thought of it, maybe I can create a custom walker for wp_dropdown_categories... | |
Jan 15, 2013 at 13:38 | comment | added | unfulvio | Thanks, but I have a problem with this solution... what if I want to insert some onchange javascript in the <select> and put the term link in the <option> value? In this way the user would get redirected to the term archive by selecting the corresponding item in the list. wp_dropdown_categories() only outputs a plain list if I'm not mistaken. | |
Jan 15, 2013 at 8:51 | history | answered | Mike Madern | CC BY-SA 3.0 |