Robbiegod
Robbiegod

Reputation: 1014

Algolia search results page, how do dynamically select a custom content type?

On my Algolia search results page, I have categories, tags, and custom content types listed there. I have standard html buttons on some pages within my site that link to the search results page and send a tag via a query string.

When a user clicks the button, I want to be able to dynamically select the "Blog" content type to only show blog posts in the search results when the "blog" button is clicked by my users.

Is there a way to do that?

I'm using the Alogolia Wordpress plugin.

Upvotes: 0

Views: 445

Answers (1)

rayrutjes
rayrutjes

Reputation: 798

This seems a bit out of scope of the default behaviour of the Algolia plugin for WordPress.

However if you really want to go that far you will need to customize the search results page template like explained here: https://community.algolia.com/wordpress/customize-search-page.html

Then you will need to set the default post type based on the query string. Here is the documentation about default filters in the InstantSearch V1 library: https://community.algolia.com/instantsearch.js/v1/documentation/#default-filters

Upvotes: 0

Related Questions