logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$10
Best way to add a search function?

I have a page which has loads of resources in different categories. I want to add a search function to that page that only searches within the resources category and sub categories.

Steve Watson | 05/18/12 at 11:58am Edit
Tutorial: How to assign prize money


(7) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    05/18/12
    12:02pm
    Fahd Murtaza says:

    Try this

    http://mywordpress.ru/plugins/search-in-category/

    • 05/18/12 12:04pm

      Fahd Murtaza says:

      google translate should help you understand easily.

  • avatar
    Last edited:
    05/18/12
    12:03pm
    Francisco Javier Carazo Gil says:

    Hi Steve,

    Which kind of data are these categories, subcategories and resouces.

    Do you use custom post type and custom taxonomies?

  • avatar
    Last edited:
    05/18/12
    12:05pm
    Agus Setiawan says:

    hi steve, hope this code will help you

    <form method="get" id="search form" action="/">
    <div>
    <input type="text" value="" name="s" id="s" />
    <input type="hidden" value="22" name="cat" id="scat" />
    </div>
    </form>

  • avatar
    Last edited:
    05/18/12
    12:06pm
    Michael Caputo says:

    You need to add a hidden field to your search form. It would look something like this:

    <CODE><input type=”hidden” name=”cat” value=”31,7″/></CODE>

    You see in the 'value' field there is 28, and 7 - change those numbers to the category ID of the categories you would like to include in your search.

  • avatar
    Last edited:
    05/18/12
    12:10pm
    Jatin Soni says:

    Place below code into the page template to search by category dropdown list.

    <form class="searchcat" role="search" method="get" id="searchform" action="<?php bloginfo('url'); ?>">
    <div class="rowElem">
    <input type="text" value="" name="s" id="s" tabindex="1" placeholder="search here..." /><?php wp_dropdown_categories( 'show_option_all=All Type' ); ?>
    <input type="submit" id="searchsubmit" value="Search" tabindex="2" />
    </div>
    </form>

  • avatar
    Last edited:
    05/18/12
    12:10pm
    Nilesh shiragave says:

    Try following plugin

    5sec category search

  • avatar
    Last edited:
    05/18/12
    12:56pm
    Arnav Joy says:

    check this link

    http://wordpress.stackexchange.com/questions/14241/search-form-with-category-and-sub-category

This question has expired.





Current status of this question: Community pot



Please log in to add additional discourse to this page.





Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.