Categories without submit button
Well one of the reason for the early launch of this blog is what you are looking for right now, the plugin that displays your categories without that anoying submit button, so it’s more that fair that this plugin be the first post in this blog.
How this work
It works exactly in the same way that wp_dropdown_categories() function. I only have added the “onchange” argument to the original function to make possible the use of the onchange() event, and the obligatory form because the original function doesn’t include it.
Values accepted by “onchange”:
- 0 = It won’t use onchange() event
- 1 = It will use onchange() event
Instalation and configuration
- Download altrugon_dropdown_categories.zip
- Unzip the file
- Place the folder altrugon_dropdown_categories in your directory wp-content/plugins
- Activate the plugin
- Paste this line in your code: <?php altrugon_dropdown_categories(’onchange_submit=1′); ?>
- Enjoy
Versions
- v1.2: Add an empty option. This is necessary when you don’t have a submit button.
- v1.1: Fix the validation XHTML issue. I have enclosed the select box inside a div which also has a class.
Well, that’s all. If you have any question or suggestion don’t hasitate to contact me.
2. April, 2007 at 21:19
I get the following error when I use your plug in:
Fatal error: Call to undefined function: get_categories() in /home/republic/public_html/wp-content/plugins/altrugon_dropdown_categories.php on line 48
2. April, 2007 at 23:56
Where in my code do I place that line? I assumed I just put it in the sidebar where I want the categories to show up, but that produced an error that didn’t let any of my content load. Plugin is installed and activated. Is there somewhere else I’m supposed to put that line?
Thank you!
3. April, 2007 at 09:24
Mike which version of Wordpress are you using. This plugin only works with Wordpress 2.1.
Try to download the plugin again; I uploaded the plugin yesterday because I found some mistakes. Make sure you clean your cache when you reinstall the plugin.
3. April, 2007 at 09:26
Lolly you can paste the line in your sidebar replacing the code that was showing your categories. It should works fine, but could you give me more information about the error, or could you show me the piece of code where you pasted the new function?.
22. April, 2007 at 02:40
Great plugin!
Thanks so much for sharing this with us..
Lolly - Make sure you copy the line in your side bar from the read me file. Sometimes if you just copy and paste the line from here you get extra characters in it which may cause an error.
24. April, 2007 at 02:22
I have wp 2.1.3 installed, found a solution almost like I was looking for, wp_dropdown_categories(), previous code was called from widgets.php (I am using widgets) and lokked like this:
<code>
</code>
I replaced it with:
<code>
</code>
(I previously activated the plugin of course)
Nothing worked, the site returned an error. Maybe this is due to the widgets plugin that I am using?
24. April, 2007 at 18:59
UncleSam I can’t see your code at all, however I’m using widgets with this theme and it works fine for me. What I did was to go to the php file that holds the category widget and over there I put the piece of code that you need to call the plugin.
I hope this will help you.
25. April, 2007 at 11:24
Am hoping to get your plugin working for my site. I’ve got it installed/activated. I placed the text from the readme in my sidebar template, but I get “Parse error: syntax error, unexpected ‘=’ in” and no other sidebar information when I save the template.
25. April, 2007 at 11:31
Ahhhhh of course it was my fault. It works perfectly now that I removed my earlier attempt at a javascript drop-down. (Silly me)
Just one question now. Is there an option to sort the drop-down list alphabetically?
25. April, 2007 at 20:13
Paul is totally possible because the plugin accepts the same parameters that the wp_dropdown_categories() function. There is a link on top of this post that will send you to the description function page in the wordpress site if you want to check which parameters you can use.
26. April, 2007 at 10:45
Works great, thanks!!
2. May, 2007 at 21:08
Ok, I’ve been using it a couple days now and it’s great. I have the working drop-down and everything is sorted the way I want. The only thing I can’t figure out is that if I’m on my blog main page and click the drop down, I can’t choose the top category (Adventure).
Instead I have to select any other category, and then choose the first one.
Is there any way to add a dummy option to the top of the list?
Like:
subjectss
Thanks,
-Paul
2. May, 2007 at 21:09
option value='' subjects /optionWhoops.
2. May, 2007 at 22:30
To be honest with you Paul, the dummy option is already added. You and I are using the same version of the plugin, but I have to tell you that although is working here I have seen that in other recent blog where I have added it is giving me the same problem than you (I think is with WP 2.1.3)
As soon I have a chance to take a look I will let you know what is happening.
ps: if you know html, try to open the plugin file and check that the empty option is over there.
3. May, 2007 at 15:43
I’ve got ‘hide_empty’ => 1 in the plugin file default array. Thanks for the help!
-PL
29. August, 2007 at 07:16
Awesome. Thanks for this plugin!
27. September, 2007 at 04:00
any plans to get this working w/ wordpress 2.2? I’m getting this error just like the first guy:
Fatal error: Call to undefined function: get_categories()
what is the equivalent to this command in wordpress 2.2?
5. October, 2007 at 23:30
Hi, I love your plug-in, it works great!
but i have a little problem, how can i make a empty default select ? the very first selection on my drop list is a category, because of that user can never select that category.
On your page, you have the default selection set to an empty category.
Can anyone teach me how to do it? Thank you
10. October, 2007 at 23:10
Sorry guys,
Apparently you were downloading the old version. Please try again and check if your previous bugs are gone.
5. December, 2007 at 10:05
I followed the directions on this, up to the last line: “PASTE into your Code”…… WHERE?????
I tried putting it at the top of the executable Code, refreshed… nothing…
Any ideas?
5. December, 2007 at 20:28
- Go to presentation > theme editor and open the file named sidebar.php - Look for the piece of code similar to this one “wp_list_categories()”
- Comment that code, don’t delete it just in case.
- Paste the new code right there in a way that fit with the rest of the file.
That’s all that you need to do; I can’t give you more details because your sidebar.php file could be different to mine.
Good luck