Reputation:
I would like to get instantsearch widget to filter Custom Post Types. So this menu filter: https://community.algolia.com/instantsearch.js/documentation/#menu only to filter Custom Post types.
I have tried it so:
search.addWidget(
instantsearch.widgets.menu({
container: '#post-type',
attributeName: 'post_type',
limit: 10,
templates: {
header: 'Post Types'
}
})
);
And of course div to render the code:
<div id="post-type"></div>
It renders the title correctly and all is working but the Custom Post Types won't get listed at all in any shape or form.
Is it even possible to render CPT this way?
Any advise appreciated.
Upvotes: 1
Views: 285
Reputation:
All that needs to happen for this to work is changing the attribute name to: 'post_type_label'
Upvotes: 1