-
Author
Tagged: search ajax-results
-
March 9, 2015 at 16:49 #49379
BDecker19
ParticipantHaving trouble getting it to display the right result types in our ajax search menu. I’ve set our options NOT to include pages, but they keep showing up. See screenshots attached.
Thanks!
BenjiAttachments:
You must be logged in to view attached files.March 9, 2015 at 17:10 #49382BDecker19
ParticipantUpdate, i’ve added the code below, and it seems to have mostly solved the problem:
COPY CODE// Avoid page results in ajax search function filter_search($query) { if ($query->is_search) { $query->set('post_type', array('post', 'event', 'product', 'topic')); }; return $query; }; add_filter('pre_get_posts', 'filter_search');
Only issue now is with one of the post types (“Event”), it doesn’t seem to be displaying a header category — see screenshot. Is there any way I can adjust this? Or if there’s an alternative solution to the original problem, that works as well!
Attachments:
You must be logged in to view attached files.March 9, 2015 at 17:34 #49387sharmstr
ModeratorYou’re setting it up wrong. The options in Theme Options are for the search in the menu.
You need to go into page editor for that page and change the options on the search form shortcode.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 9, 2015 at 17:37 #49388BDecker19
Participantinteresting. ok, lemme check. although I’m getting pages in the results there too? screenshot attached.
Attachments:
You must be logged in to view attached files.March 9, 2015 at 17:48 #49390sharmstr
ModeratorThe filter definitely works on a non modified install of kleo.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
Attachments:
You must be logged in to view attached files.March 9, 2015 at 17:49 #49393sharmstr
ModeratorFor what its worth, something I find really helpful is a vanilla install of Kleo. I can use that to see if I’ve, or a plugin has screwed up the default functionality of Kleo.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.