PHP

how to implement AJAX in wordpress themes

I am going to show you how we can implement Ajax in our WordPress themes with the help of simple example.
Article is at 1stwebdesigner

2 comments

hello Adnan,

this is regarding the article u posted” How to Implement Ajax in WordPress Themes ”
in the template file i added this custom taxonomy called state

” wp_dropdown_categories(‘show_count=0&selected=-1&hierarchical=1&depth=1&hide_empty=0&exclude=1&show_option_none=Main Categories&name=main_cat&taxonomy=state’); ”

now im able to populate the taxonomy terms in the drop down, but when i give the sub taxonomy(child) of the state, in here

” $categories= get_categories(‘child_of=’.$_POST[‘main_catid’].’hide_empty=0&taxonomy=city’); ”

the drop down does not populate the child taxonomies, but the 2nd drop down is in active when i select the 1st drop down.

Sorry Little correction i have the following structure

* Animals

Dog
Cat
Tiger
Lion

* Vehicles

Scooter
Bike
Car
Truck

im getting the 1st drop down as Animals and Vehicles, when i select Animals im not getting the sub cat values, i changed the code in
” $categories= get_categories(‘child_of=’.$_POST[‘main_catid’].’hide_empty=0&taxonomy=city’); ” to as
” $categories= get_categories(‘child_of=’.$_POST[‘main_catid’].’hide_empty=0′); ”

still it does not populate the sub cats. but when i increased the depth –> 2 in
” wp_dropdown_categories(‘show_count=0&selected=-1&hierarchical=1&depth=2&hide_empty=0&exclude=1&show_option_none=Main Categories&name=main_cat&taxonomy=state’); ”

im getting this in the 1st drop down

* Animals

Dog
Cat
Tiger
Lion

* Vehicles

Scooter
Bike
Car
Truck

Leave a Reply