• auconnor

    (@auconnor)


    On the search results page, I would like to only display the categories and tags that are within the search result set.

    I’m somewhat new to WP, and was thinking about storing post categories within the have_posts() loop and use the include parameter in wp_list_categories (and same for tags), but was curious to what others thought – ie, if something already existed with this functionality.

    I’ve searched and cannot find anything. Does anybody know of a plugin or can point me in the right direction?

    Thanks..

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter auconnor

    (@auconnor)

    I’m really at a loss here. If someone wouldn’t mind pushing me in the right direction, I would appreciate it. If it’s something obvious or I should know, i apologize in advance.. ??

    The short: I want to narrow/ filter my search results by category and tags.

    I want to do the same thing… if I’m understanding auconnor correctly. Anybody know how to do this, or what plugin to use?

    This is the best I could come up with.

    I looked for a very long time to find a tag filter system similar to what you are describing, but I couldn’t find one, so this is what I came up with for my page:

    sciemploy

    I used the plugin, Category Page which can be found at:

    Category Page

    It lets you connect pages to your category archive pages, showing them as a header. So, whatever you put in the connected page will show up as a header every time you click the category it has been connected to. The beauty of this is that you can have a separate header for each category that you have.

    Using that plugin, I connected an unpublished (so it wont show up on the title bar) page to each of my categories, which on my website, are the provinces of Canada. For the Category Page plugin to work properly, you have to publish the linked page when doing the connection. You can then switch it to unpublished right after, though.

    Each of the connected pages has a set of Icons with links that look something like:

    https://sciemploy.ca/tag/environment+bc/
    https://sciemploy.ca/tag/engineering+bc/
    …etc

    For each category, you have to switch the second tag in the link to match the category it will be searching within.

    So on my website, when you click a category (Province), it shows all of the companies in my directory from that province, but when you click on the buttons in the category page header, it essentially does a double tag search (Province + Industry).

    You just have to make sure you tag all of your posts with both the Category name and your refined search parameter. In my case, I tag every post by Province, which is also the category I file it under, and by the Industry.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filtering Search Results’ is closed to new replies.