Jump to content

Custom Search. Refine search by category and sub​​-category

Recommended Posts


Hello everybody,

I'm building a new site with Pagelines and would request special assistance.

Well, I want to offer a customized search engine on my new site, as this will be an advertising site, where I have registered several companies from various sectors. So, I want to allow users have a filter the search by category.


I will create several categories that will be the States of my Country and sub​​-categories that are the Cities of each state. So, I want that the user can choose which place he wants to search.

Well, I searched few plugins they can offer this, but not found.

In this case, only the search form, more two 'Select'. Being one for category and another for sub-category that appears when the user selects a category.

Well, here's an example of what I want:


If someone can give me a hint how I can do this, I'll be very happy and grateful. Or, if you know a plugin that has this functionality, even better! :D

The search system WordPress is very simple! Well they could offer something more sophisticated! :mellow:

Thank you!

Share this post

Link to post
Share on other sites

Hi Danny, Thanks for the tip, I'll test this plugin. :)

But what I really wanted was a hint of how to implement the "Select" for categories alongside the search form of theme to filter the search by category.

I tried something like the example below, it works, but it brings all categories, I wanted to implement with other select for sub-categories according to the previously selected category.


<form role="search" method="get" id="searchform" action="<?php bloginfo('siteurl'); ?>">


    <label class="screen-reader-text" for="s">Search: </label>

	 <input type="text" value="" name="s" id="s" />

   <?php wp_dropdown_categories( 'show_option_all = Filter by: ' );?>	 <input type="submit" id="searchsubmit" value="Submit" />



I believe it is something complicated, you may need PHP code, so come help.

Anyway, I appreciate your help!

Share this post

Link to post
Share on other sites

We can close this topic!

Share this post

Link to post
Share on other sites

The topic was marked as resolved.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • stijnxo
      By stijnxo+
      Is it possible to get the children of the parent page in Powerloop using Custom Taxonomy and Custom term?
    • mtaus
      By mtaus
      How can I remove the Search function from NavPro?
    • JP
      By JP+
      We are working on a 2 languages site (https://liguecardioliga.be) with wpml, and lately the call of a category in the loops section (and all the sections requiring a category to select posts) doesn't work in the translated language. It worked well until recently so I wonder if it's because of a recent update (wordpress, wpml, pagelines, a plugin?). Anyone has the same problem? a solution?
    • John Olsson
      By John Olsson+
      Hello, i'm working on a webshop, and got this code to really boost the search within WP. But when adding this code to functions.php the front end media library search flipped totally, and not working at all, any ideas what's the problem?
      function atom_search_where($where){ global $wpdb; if (is_search()) $where .= "OR (t.name LIKE '%".get_search_query()."%' AND {$wpdb->posts}.post_status = 'publish')"; return $where; } function atom_search_join($join){ global $wpdb; if (is_search()) $join .= "LEFT JOIN {$wpdb->term_relationships} tr ON {$wpdb->posts}.ID = tr.object_id INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id=tr.term_taxonomy_id INNER JOIN {$wpdb->terms} t ON t.term_id = tt.term_id"; return $join; } function atom_search_groupby($groupby){ global $wpdb; // we need to group on post ID $groupby_id = "{$wpdb->posts}.ID"; if(!is_search() || strpos($groupby, $groupby_id) !== false) return $groupby; // groupby was empty, use ours if(!strlen(trim($groupby))) return $groupby_id; // wasn't empty, append ours return $groupby.", ".$groupby_id; } add_filter('posts_where','atom_search_where'); add_filter('posts_join', 'atom_search_join'); add_filter('posts_groupby', 'atom_search_groupby');  
    • Queue-it
      By Queue-it+
      Search function doesn't seem to work. 
      When ever searching for something it redirect to the home page and add the search string to the url.
      For example searching for "cases" it would display https://queue-it.com/?s=cases
      Do you know how to solve that?