Well after working with Wordpress for about 4 years now, I have finally got around to developing my very first Wordpress plugin. Category Ajax Chain Select plugin pretty much does exactly what it says, it creates a chain select based off the category hierarchy in your Wordpress install.
This plugin came about because for once I couldn’t find a plugin that already had this functionality for Wordpress, so I thought it should be a simple plugin to get me going. At present it is very basic, using a template tag below, you can place the chain selects any where on the your page template and then style it using CSS.
chainselect_getcategories();
The plugin also has the ability to pass the category level through, so if you wanted 3 levels of categories to show you could use the template tag as (by default it will always show 2 levels of categories if no value is past):
chainselect_getcategories(3);
I will continue to work on this plugin over time and add new features such as page codes so that you can add the select boxes stright into your posts & pages. In the meantime if there are any plugin developers out there that would like to help me develop this plugin then please do get in touch.
The plugin is now live on Wordpress.org and is called Category Ajax Chain Select.
PLEASE BEWARE THIS PLUGIN WILL ONLY WORK IF YOU ARE USING %category% IN YOUR PERMALINK





I’ve got error message when I try to switch the color… Nice template !
Hi Li-An,
Thanks will take a look, was working at some point.
** All seems to be working again, plugin conflict I believe **
Regards
Pete
nice plugin, but i’ve got the follwing issue on my site:
Warning: shell_exec() has been disabled for security reasons in /www/htdocs/w00ba3d8/wp-content/themes/caribou/index.php on line 5
what could be the reason for that?
thanks
parser022
Hi parser022,
Ok from the error message you are getting, it seems like it might be a issue with the settings in your php.ini file on your server.
Your PHP configuration doesn’t allow the ’shell_exec()’ function. This is one of the functions disabled when PHP is run in Safe Mode.
Best thing to try is to upload a blank php file to your server containing this code:
<?php phpinfo(); ?>Then open it in your browser and look for Safe Mode settings and disable functions and see if shell_exec is listed.
If it is then you might want to ask your host company to change the settings for you if you dont have access to the php.ini file.
Regards
Pete
keep getting error:
Warning: Cannot modify header information – headers already sent by (output started at /home/xyz/public_html/accesspointnames.com/wp-content/plugins/category-ajax-chain-selects/chainselects.php:66) in /home/xyz/public_html/accesspointnames.com/wp-includes/classes.php on line 1586
what am i doing wrong?
exactly not sure how to use this plug in.
i am looking for for a wp plugin/widget that would do this:
user/visitor selects category A, (for example Country A), gets choices 1, 2, 3, and each choice lists info xyz
does this plugin do what i need?
Hi Mike,
I don’t think this plugin is going to do what you need. At present it just populates one drop down per category level you have on your website.
So for example:
‘Car Make’ -> ‘Car Model’ -> ‘Car Engine’
This would populate the ‘Car Model’ based on what you have selected in the ‘Car Make’ drop down and so on.
To be honest I need to go back and re-write this plugin as it has quite a few bugs at the moment. I’ve got 2 new plugins to release over the next couple of weeks, once I have these finished I will re visit this plugin and make it more functional and get rid of the error you are seeing.
Regards
Pete
ty great plugin
pls update m8
Hi, very nice plugin.
1. Can I setup name of dropdowns? (like name: dropdown1, name:dropdown2)
2. Is it possible to show drop-downs inline?
Thanks in advance
Sorry for double reply.
I looked into your code around 74 line:
for ($x = 1; $x < $cat_cnt+1; $x++) {
$chainselect .= "
So I need to add something like:
if $cat_cnt=1 (“name of dropdown1″)
if $cat_cnt=2 (“name of dropdown2″)
Can you help?
Btw, i solved second question.
Hi Maker,
If you want to add labels to the drop downs please replace line 112 in the chainselects.php file:
$chainselect .= “< li >< select id='dhtmlgoodies_".$x."' name='dhtmlgoodies_".$x."' onchange='get".($x+1)."List(this)' >“;
With the following:
if ($x == 1) { $selectname = “[NAME HERE]“; }
if ($x == 2) { $selectname = “[NAME HERE]“; }
if ($x == 3) { $selectname = “[NAME HERE]“; }
$chainselect .= “< li >< label >“.$selectname.”< select id='dhtmlgoodies_".$x."' name='dhtmlgoodies_".$x."' onchange='get".($x+1)."List(this)'>“;
Replacing [NAME HERE] with your the name of the label.
Also you will need one of these lines for each level of category you have.
if ($x == 1) { $selectname = “[NAME HERE]“; }
Make sure you remove the spaces in the li and select tags, I had to add them for them to display in the comment.
If you have and trouble please do let me know.
Regards
Pete
Hi Peter J Harrison,
Thanks. It’s working perfectly.