Jump to content
joseneas

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

Recommended Posts

joseneas    2
joseneas

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.

Example:

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:

filtrando-a-busca-por-estado-e-cidade.png

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
joseneas    2
joseneas

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.

EX:


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

  <div>

    <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" />


  </div>

</form>

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
joseneas    2
joseneas

We can close this topic!

Share this post


Link to post
Share on other sites
Simon    247
Simon

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

    • JP
      By JP+
      Hello,
      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?
      TIA
    • 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+
      HI,
      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? 
    • MissT
      By MissT+
      Would be great to have the ability to include a search option within menus and within Splashup - is this possible?
    • balfred1345
      By balfred1345
      null When I tested Search using the search field in Navi, it throws the error as shown in pastebin: http://pastebin.com/DJ079bmy
      Is there a fix for this? If there is no fix, can you please tell me how to disable search in Navi?
      Thanks,
      Bruce
×