Tagged: Custom Post Type, search
-
AuthorPosts
-
January 4, 2018 at 4:26 pm #893271
Hi, have been serching for a solution for several hours but can’t get it work completely.
See picture. Ajax search works fine with Relevansi except it doesn’t show custom post type results in page.
Custom post type is “kurz” (course in Czech). It is checked to be indexed, new index was created. The post type is searchable (not excluded from search). Could someone push me towards the correct solution? Thank you!
See image https://drive.google.com/file/d/1ACLCB6_NXkFk6KR1s6ysCGwQpwYurYD1/view?usp=sharing- This topic was modified 6 years, 10 months ago by jetel.
January 9, 2018 at 5:43 am #895090Hey jetel,
Thank you for using Enfold.
Did you create a custom taxonomy for the custom post type? If you didn’t create a custom taxonomy yet, please create one, apply it to the custom post type items then enable it in the Relevanssi settings.
Best regards,
IsmaelJanuary 9, 2018 at 1:30 pm #895225Hi Ismael,
thank you for your reply. Yes, I have already taxonomy for it called “portfolio_category ” and it works. All changes to functionality is done via my own plugin. I added several post types, shortcodes etc. and it all works.
Now I have found a solution. I had to add a script to my plugin that enables search within defined post types:add_filter( 'pre_get_posts', 'jetel_search' ); function jetel_search( $query ) { if ( $query->is_search ) { $query->set( 'post_type', array( 'post', 'page', 'kurz', 'lektor', 'portfolio' ) ); } return $query; }
I have another question. How to limit a number of results in each category in instant search. Mean 3 results for pages, 3 for posts, 3 for courses…
And how to display similarly sorted results in page?- This reply was modified 6 years, 10 months ago by jetel.
January 10, 2018 at 10:55 am #895594Hi,
I have another question. How to limit a number of results in each category in instant search. Mean 3 results for pages, 3 for posts, 3 for courses…
This thread will help.
// https://kriesi.at/support/topic/optimize-search-results/#post-846719
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.