[wp-hackers] Search in multiple categories

Tom Jenkins tom at thejenkinsweb.com
Sun Jan 16 22:15:48 UTC 2011


You just need to have your category dropdown within the search form itself.

<form method="get" id="searchform" action="<?php bloginfo('url');?>/" >
<label for="s">Search</label>

<input type="text" value="<?php echo
attribute_escape(apply_filters('the_search_query', get_search_query())) ?>"
name="s" id="s" />

<label for="">Topic</label>

<?php
wp_dropdown_categories('depth=0&orderby=name&hide_empty=1&show_option_all=Search
Everything'); ?>

<input type="submit" id="searchsubmit" value="Search" />

</form>


Tom

==============================
Tom Jenkins
Development Director for Adcuda <http://adcuda.com>
Web: http://techguytom.com
twitter: http://twitter.com/techguytom



On Sun, Jan 16, 2011 at 7:23 AM, Tareq Hasan <tareq1988 at gmail.com> wrote:

> Hello all,
> I need some help in a search functionality. Suppose I have a widget with
> search box and there is four category dropdown. I want to search for the
> query only in selected 4 categories. So what will be the procedure? and how
> to give the names of category fields?
>
> I tried with the two query form (showing with 2 cat):
> (1) ?s=wifi&sa=search&cat[]=61&cat[]=62
> (2) ?s=wifi&sa=search&cat=61,62
> Both didn't work what I wanted.
>
> Please help me.
> --------------------------------------------
> Best regards
> Tareq Hasan
> Blog <http://tareq.wedevs.com> | Twitter
> <http://twitter.com/tareq_cse> | বিএলইউএ
> - লিনাক্স টিউটোরিয়াল, টিপস-ট্রিকস, রিভিউ <http://linux.org.bd/>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list