Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm new to wordpress and PHP Im trying to build a site that the user can select a destination so I did this by creating categories (country) subcategories (state) sub sub category (city) and I want to split them into 3 dynamic drop down menus when you select country the state automatically populates according to the parents then the same with city, then it will do a search for destinations (posts) attached to the selections.

So far I have one dropdown working but is listing all (parent, children, grandchildren) categories and doing the search correctly. how can I split them?

<?php $thecategories = array(
        'show_option_all'    => '',
        'show_option_none'   => '',
        'orderby'            => 'ID', 
        'order'              => 'ASC',
        'show_count'         => 0,
        'hide_empty'         => 1, 
        'child_of'           => 0,
        'exclude'            => '',
        'echo'               => 1,
        'selected'           => 0,
        'hierarchical'       => 0, 
        'name'               => 'cat',
        'id'                 => '',
        'class'              => 'postform',
        'depth'              => 0,
        'tab_index'          => 0,
        'taxonomy'           => 'category',
        'hide_if_empty'      => false
    ); ?>

<form action="<?php bloginfo('url'); ?>" method="get">
  <?php wp_dropdown_categories( $thecategories ); ?>
  <input type="submit" name="submit" value="view" />
</form>
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I found a solution for this in case someone else has this issue, there is a plugin that can help achieve this it is called Category Ajax Chain Selects http://wordpress.org/extend/plugins/category-ajax-chain-selects/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.