Errr… It’s not supposed to do anything when you select them. What did you expect it to do?
Maybe I am naive… but I expected that when I “select” a category from the dropdown list – it will take me to that category’s archive.
OK, I looked at the widget in the wp-includes/widgets.php, now I see what you meant. Not sure I can copy from there but will try something.
The widget for categories that you can use in 2.3.1 has the option for a dropdown and it works fine at my site.
Moshu, here’s the working dropdown categroy for WordPress 2.3.x that I’ve configured on my blog, you can modify parameters as you like:
<form action="<?php bloginfo('url'); ?>" method="get"><?php wp_dropdown_categories('orderby=name&order=ASC&show_count=1&hierarchical=1&show_option_all=Category Archives'); ?><input type="submit" name="submit" size="40" value="Go" /></form>
OK, with some help from Otto I have solved this: you need the JS after the template tag:
Moshu, why do you want to add JS? When you can get full working dropdown with the code, I posted above!
This is just a query only.
Rok,your code doesnt work for me. I cant just select a dropdown item and automatically jump, I still have to click the “Go” button. Im in Safari.
Moshu, your code DOES work though, thanks!! 🙂
However, now I’m trying to get tricky, and have FOUR dropdowns, each one for a different category, and of course each using this JS solution. However, wp_dropdown_categories automatically assigns each one the name and id of “cat”, so it only recognizes the first one. Does anyone know of a way to make it work? 🙂
Rok,your code doesnt work for me.
It won’t, ‘coz it’s based on select and submit function. See the last line of the code.
<input type="submit" name="submit" size="40" value="Go" />
Right. But you were wondering why Moshu would want to use JS when your solution would work without it. Which it doesnt, not as Moshu was attempting to make it work at least, but just as a regular old dropdown with a submit button.
Thanks for this; it’s just what I needed, too. Having a drop-down and then a submit button seems an inelegant solution for the user; much better to have the category auto-select.
Moshu…you rock!!! This isn´t the first time I find a solution thanks to your post.
I tried using the code chunk provided and it’s not firing the onChange event for some reason.
I’m getting no errors… so I’m not sure where to go with this.
I’m new to the WP world, so I don’t know what all is going on when the page is loaded. In theory it should be working.
I’m not sure if anyone is still keeping up with this thread, but moshu, thank you for this! It’s just what I needed. My only question is how can I use your code and have the categories be alphabetized within the drop down? I know it’s something simple but I’m a little shaky with everything wordpress-related and I can’t seem to get it. I’ve read a million things on here and am getting more confused for something that is probably so simple to change. Any help would be appreciated!
Hello, It´s me again. I´m tryng the dropdown menu with the child_of parameter. I want that when I select a sub-category item its redirects to siteurl/category/parent_category/child.
So, if the parent category is “links”, when I select the “links_2” sub-category from the dropdown menu list I want that the url looks like this: site_url/category/links/links_2.
If I put a list_category in the sidebar and I click in a sub-category, the url looks like the url I want, but when I select a sub-category from the dropdown the url looks like this: siteurl/?cat=#
note: # = sub-category ID.
Any ideas about how to change it?
Thanks in advance.
ps: sorry for my bad english.
- The topic ‘Is the new dropdown_categories working?’ is closed to new replies.