Advanced Search Form – Post Types Dropdown
-
Hello, I am working on a site where I am trying to build an advanced search form and so far it’s coming along good except I am having a problem with creating a drop down for post type selection. This is my form code so far (I removed all my divs to simplify it)
<form method="get" id="searchform" name="searchform" action="<?php echo home_url(); ?>/"> <select name="posttype"> <option name="product" value="product">Legal Documents</option> <option name="videos" value="videos">Legal Advice - Videos</option> <option value="link">Legal Advice - Links</option> <option value="text">Legal Advice - Articles</option> <option value="post_type_c">An Attorney</option> </select> <input name="s" id="s" class="s" type="text" onfocus="if(this.value=='<?php _e('');?>') this.value='';" onblur="if(this.value=='') this.value='<?php _e('');?>';" value="<?php _e('');?>" /> <button tabindex="2" type="submit" class="search_btn"> </button> <?php wp_dropdown_categories( 'taxonomy=videoscategory&show_option_all=All Practice Areas' ); ?> <?php wp_dropdown_categories( 'taxonomy=states&show_option_all=All U.S States' ); ?> </form>
The drop down categories are working as should, but the drop down for the post types are not working at all. This is the URL structure returned – https://domain.com/?posttype=product&s=guide&cat=2707&cat=0
I’ve also tried – https://domain.com/?post_type=product&s=guide&cat=2707&cat=0
But neither seem to be working. How can I fix this? Any help is appreciated. Thanks.
- The topic ‘Advanced Search Form – Post Types Dropdown’ is closed to new replies.