Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="<?php bloginfo('url'); ?>" method="get">
- <div>
- <?php
- $taxonomies = array('TAXONOMY NAME');
- $args = array('orderby'=>'name','hide_empty'=>true);
- $select = get_terms_dropdown($taxonomies, $args);
- $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
- echo $select;
- ?>
- <noscript><div><input type="submit" value="Näytä" /></div></noscript>
- </div></form>
- <?php
- function get_terms_dropdown($taxonomies, $args){
- $myterms = get_terms($taxonomies, $args);
- $output ="<select name='TAXONOMY SLUG'>";
- foreach($myterms as $term){
- $root_url = get_bloginfo('url');
- $term_taxonomy=$term->taxonomy;
- $term_slug=$term->slug;
- $term_name =$term->name;
- $link = $term_slug;
- $output .="<option value='".$link."'>".$term_name."</option>";
- }
- $output .="</select>";
- return $output;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement