WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Search Dropdown (1 post)

  1. lowestofthekeys
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by lowestofthekeys
  • This topic is not resolved
  • WordPress version: 3.4.2