Using “Search” for searching all questions displaying all results?

10.44K viewsCoresearch
0

When a website visitor is using “Search” for searching all questions, rather than displaying the results from their specific search the content below is just the list of all results.

Also, I see that Ans 4.1.5 is out, but WP repository doesn’t show that it isn’t available?

Answered question
1

Hi Rahul,
for themes like the one that florinb has, who have an option to include just “posts” in search, i think you need to add the post_type to your “loop_start” hook from qaquery_hooks.php .
so instead of
if ( $query->is_main_query() && $query->is_single() && ‘question’ === get_query_var( ‘post_type’ ) ) {
$query->posts[0]->post_content = ‘[anspress]’;
}
you should have
if ( $query->is_main_query() && $query->is_single() && ‘question’ === get_query_var( ‘post_type’ ) ) {
$query->posts[0]->post_content = ‘[anspress]’;
$query->posts[0]->post_type = ‘post’;
}
this way, you’ll make sure your injected post is treated as a “post”.

Posted new comment

Hello,
Thanks for your suggestion. I will give it a try.

0

I have the same issue:
Default theme search string overwrites anspress search. I am using “smart mag” theme and the search string looks like one below, which is identical to anspress search string.
/?s=anspress
this might not be an isolated case, as Michael as highlighted this issue.
________
@Rahul, do you think it’s possible to make anspress search string different from the default one that themes use?
I consider buying the askbug theme as well but if I can’t use the search, i can’t move forward.
Thanks,
Florin

Posted new comment

Okay. Let me think, what can I do here. I will add it to our current roadmap. Thanks for reporting.

0

Just switched the TwentySixteen and discovered it is a theme conflict. Looking to see if I can get an updated theme files.

0

I just deactivated all plugins but not AnsPress and still the search results are not filtering when a search word is entered.

0

Hello Rahul,

So if my search function is not working then I most likely have some sort of plugin/theme conflict?

commented on answer

Hello Michael,
Have you tried source from GitHub master branch?

0

Well, for some reason the search feature is not working on my installation. Any ideas why it might not be working?

0

Hello Michael,

Search is working fine. You can try it on demo: Search.

4.1.5 is not published to wp.org because I discovered few bugs yesterday which was fixed but will wait for contributors input. Thanks for your patience.

Posted new comment

search box no working