How to make Search Form with Custom Taxonomy Dropdown
-
hey guys, I wanna make Search Form with Custom Taxonomy Dropdown to my website and I made it but It doesnt work. I dont know why it doesnt work.
I call it as “drop-down-taxonomy.php” in kutuphane folder and I use this code in functions.php “include ‘kutuphane/drop-down-taxonomy.php’; “
and also I use this code to show it on sidebar:<div id="browselist" class="clearfix"> <h3 class="sidetitle">Arama Listesi</h3> <p class="listin"><span>Semt</span><br/><?php the_dropdown_taxonomy('semt'); ?></p> <p class="listin"><span>Listeleme Durumu</span><br/><?php the_dropdown_taxonomy('mdurumu'); ?></p> </div>
I use this code(drop-down-taxonomy.php):
<?php function the_dropdown_taxonomy($taxonomy) { $id = "{$taxonomy}-dropdown"; $js =<<<SCRIPT <script type="text/javascript"> jQuery(document).ready(function($){ $("select#{$id}").change(function(){ window.location.href = $(this).val(); }); }); </script> SCRIPT; echo $js; $terms = get_terms($taxonomy); echo "<select name=\"{$id}\" id=\"{$id}\">"; echo '<option value="#"> - Select - </option>'; foreach($terms as $term) { echo '<option value="'; echo get_term_link(intval($term->term_id),$taxonomy); echo '">' . "{$term->name}</option>"; } echo "</select>"; } add_action('init','jquery_init'); function jquery_init() { wp_enqueue_script('jquery'); } ?>
When I wrote these code, I can see search form with taxonomy dropdown but when I click or enter, It doesnt work :/
Who will help me about this quesiton?Notice: I cant talk fluent so write me using simple language
??
- The topic ‘How to make Search Form with Custom Taxonomy Dropdown’ is closed to new replies.