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 have been trying to make a multi-level(relational/dependable) drop down menu.

What i really want to do is, give the user to search for a mobile company(lets say Samsung) and then show the Phones that have Samsung as there Company. I am using the plugin Advanced Custom Fields where all my data is being stored as a custom field.

This is a form which i made to to get what i want. But i don't know how to use jquery to show the required drop-down.

<center>Chose your mobile</center>
<div class="mob_comp" style="margin-right:25%; margin-left:25%;">
<div style="float:left;">
<select id="mob1_company" name="mob1_company" onchange="document.getElementById('showme').style.display=this.selectedIndex==0?'none':'block';">
<option value="">Select a company</option>
<option value="samsung">Samsung</option>
<option value="sony">Sony</option>
<select id="p1" name="p1">
<option value="">Select a mobile</option>
global $post;
$args = array( 'numberposts' => -1, 'category_name' => 'Mobiles',   'orderby'  => 'title', 'order' => 'ASC', 'meta_key' => 'mobile_company', 'meta_value' =>     'Samsung');
$posts = get_posts($args, ARRAY_A);
foreach( $posts as $post ) : setup_postdata($post); ?>
<option value="samsung_<?php echo $post->ID; ?>"><?php the_title(); ?></option>
<?php endforeach; ?>
global $post;
$args = array( 'numberposts' => -1, 'category_name' => 'Mobiles',   'orderby'  => 'title', 'order' => 'ASC', 'meta_key' => 'mobile_company', 'meta_value' =>     'Sony');
$posts = get_posts($args, ARRAY_A);
foreach( $posts as $post ) : setup_postdata($post); ?>
<option value="sony_<?php echo $post->ID; ?>"><?php the_title(); ?></option>
<?php endforeach; ?>

I am trying to use sony_(postid) to call it. It'll be much better for me If i could use a div tag to called the required select field using the js.

Hope you guys can help me.


share|improve this question
Anyone??? Please?? Its important... –  Prateek Kathal Jun 28 '13 at 12:45
add comment

Your Answer


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

Browse other questions tagged or ask your own question.