WordPress.org

Support

Support » How-To and Troubleshooting » Advanced Search Dropdown

Advanced Search Dropdown

  • Hi everyone,

    I am just confused, and looking for a little direction.

    I am attempting to create a search function that uses a dropdown to filter through categories. This is the current code inhabiting my searchform.php:

    <div class="search_field2"><form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>" >
    
        Search for:
        <input type="text" value="" name="s" id="s" />
        in <?php wp_dropdown_categories( 'show_count=1&orderby=asc&show_option_all=All Categories' ); ?>
        <input type="submit" id="searchsubmit" value="Search" />
    
    </form>
    
    </div>

    This gives me a basic searchable dropdown, unfortunately it doesn’t exactly meet what I’m looking for.

    What I am wondering is if there is a possibility that I can change the search using a search filter function or something to only display the top parent categories, but also search through the child and grandchild categories of each of the parents (I’ve been trying to search for a way to do this using the descendant option as well, but no luck on that).

    I tried before using the depth option for wp_dropdown_categories but unfortunately, I was still not able to pull any search results from the child/grand child categories.

  • The topic ‘Advanced Search Dropdown’ is closed to new replies.