-
AuthorPosts
-
June 12, 2020 at 7:17 pm #1222162
Hi,
When a research gives a lot of results, they are not all visible on the page and so, the “See all results” button is not available (see screenshot in private content).
Could you please tell me how I can limit the number of displayed results?
If needed, you can find a link and credentials to my website in private content.
Thanks a lot!June 16, 2020 at 3:24 pm #1223068Hey fcp,
Please have a look at the following article:
If you need further assistance please let us know.
Best regards,
VictoriaJune 18, 2020 at 3:41 pm #1223755Hi Victoria,
Thanks for your reply.
I had a look to the article but I think it deals with changing the number of results per page.
This is not what I need here.
The only thing I need is limiting the number of results under the search bar in the main menu, as shown on the screenshot.June 18, 2020 at 6:37 pm #1223862Hi fcp,
Please have a look at the following thread:
https://kriesi.at/support/topic/limit-ajax-search-results-with-relevanssi/#post-404320If you need further assistance please let us know.
Best regards,
VictoriaJune 19, 2020 at 11:36 pm #1224185Hi Victoria,
Thanks for your reply.
The last code given by Josue could be a solution for me:.ajax_search_response { max-height: 300px; overflow-y: scroll; }
…but I would need to make the scrolling bar always visible.
Which code do I need to add to achieve this?
Thanks a lot!June 22, 2020 at 7:24 pm #1224681Hi,
Try adding the following as well:
overflow:visible
Best regards,
Jordan ShannonJune 22, 2020 at 10:58 pm #1224741Hi Jordan,
I’m sorry but your code doesn’t work at all.
It only shows what needs to be hidden…June 23, 2020 at 9:48 am #1224792Hey,
I added following code to bottom of Quick CSS field
#top #searchform .ajax_search_response { max-height: 300px; overflow-y: scroll; }
Please review your website :)
Best regards,
YigitJune 23, 2020 at 2:18 pm #1224879Hi Yigit,
I already added this code given by Josue in the mentioned topic.
What I would need now is making the scrolling bar (see screenshot in private content) always visible, to make understand to the user that the submenu can be scrolled.
Thanks!June 23, 2020 at 3:35 pm #1224897Hi,
This is default browser behaviour. There should be workarounds like the one I attached in private content field however unfortunately, such customizations would be out of the scope of our support :)
Best regards,
YigitJune 24, 2020 at 12:12 am #1224969Oh really ? :-( Ok!
And there really is no CSS solution to show only 5 or 6 products in the search results and “Show more results” button at the end?June 24, 2020 at 3:27 pm #1225253Hi fcp,
It’s not the css that gets the work done in this case, it’s php, JavaScript, html and css.
Best regards,
VictoriaJune 24, 2020 at 6:36 pm #1225307you do not want to limit the number on the search results page – only on the preview in the ajax search ?
put this to your child-theme functions.php:
add_filter('avf_ajax_search_query', 'avf_modify_ajax_search_query', 10, 1); function avf_modify_ajax_search_query($search_parameters){ parse_str($search_parameters, $params); $params['numberposts'] = 5; $search_parameters = http_build_query($params); return $search_parameters; }
to limit the results per page on the search-results page there are some codes here on the board. To get rid of the pagination with css is easy.
June 24, 2020 at 10:50 pm #1225365Hi Guenni,
Thanks for your reply.
Only on the preview in the ajax search, that’s exactly what I need.
I’m sorry but this function doesn’t work for me :-(June 24, 2020 at 11:04 pm #1225369and you inserted it to your child-theme functions.php ?
and you are shure ? All caching tools resettet? all merging refreshed? All browser cache deleted? etc. ppsee here my test page: https://webers-testseite.de/
Limit set to 3
search for youtube or masonry Then see the results pageJune 25, 2020 at 12:26 am #1225383Sure :-(
I did everything you mentioned. I also tried on another browser.
But it doesn’t work.June 25, 2020 at 6:03 am #1225408But as you can see on my test installation – that is what you like to have.
And you have the normal implemented Search function of Enfold – or do you have relevansi or something else on start?
Try to deactivate all your plugins to see if there is something hampering that function. On my testpage it is Enfold 4.7.5.June 28, 2020 at 11:35 pm #1226248Hi Guenni,
Thanks for your reply.
The issue came from Relevanssi extension. I deactivated it and your function works.But I need Relevanssi for other actions.
Do you think your code can be adjusted to work with it?
Or maybe Relevanssi settings??Thanks a lot!
June 30, 2020 at 11:10 am #1226687Hi,
You can try the snippets provided in the following documentation to limit the number of items in the AJAX search results.
// https://www.relevanssi.com/knowledge-base/posts-per-page/
And you will have to implement this as well.
Best regards,
IsmaelJuly 1, 2020 at 11:41 pm #1227351Hi Ismael,
Thanks for your reply.
Once again, limiting posts per page is not what I need and this documentation seems to deal with that.
I only need to limit search results in the menu.
But since some days, I now have a bigger problem! Absolutely no result is displayed in the search bar and I don’t know what happened :-(July 6, 2020 at 7:52 am #1228197Hi,
limit search results in the menu.
The snippets in the documentation will also limit the number of results displayed in the AJAX search. Just make sure that you’re using the relevanssi_do_query filter or function instead of the default get_posts function used in the theme.
Add this snippet first to replace the default posts function:
add_filter('avf_ajax_search_function', 'avia_init_relevanssi', 10, 4); function avia_init_relevanssi($function_name, $search_query, $search_parameters, $defaults) { $function_name = 'avia_relevanssi_search'; return $function_name; } function avia_relevanssi_search($search_query, $search_parameters, $defaults) { global $query; $tempquery = $query; if(empty($tempquery)) $tempquery = new WP_Query(); $tempquery->query_vars = $search_parameters; relevanssi_do_query($tempquery); $posts = $tempquery->posts; return $posts; }
.. then include this to limit the number of results:
add_filter( 'relevanssi_modify_wp_query', 'rlv_postsperpage' ); function rlv_postsperpage( $query ) { $query->query_vars['posts_per_page'] = 5; return $query; }
Best regards,
IsmaelJuly 11, 2020 at 1:02 am #1229506Hi Ismael,
Thanks for your reply.I gonna try your function later and I will have some questions about it.
But for now, I absolutely need to make my search dropdown visible again.I tried many things:
– disable all added functions related to search in my functions.php file
– disable all added CSS related to search in my style.css file
– delete searchform.php file I added in my child theme to transform the classic theme search to WooCommerce products search
– deactivate Relevanssi extension
…but there’s nothing to do. The search dropdown is still hidden and I don’t know why!I worry a lot about this because I will need to put my website online in the next weeks :-(
Do you have an idea of what happened? Could you please help me on this?
July 14, 2020 at 12:49 pm #1230277Hi,
Sorry for the delay. We get a 500 internal server error whenever we try to search for posts. Did you modify the funtions-enfold.php file before? This file contains the AJAX search function (avia_ajax_search). We also tried to implement the Relevanssi function but it’s still not working.
Please post the FTP details in the private field so that we can check the issue further.
Best regards,
IsmaelJuly 15, 2020 at 1:31 am #1230475Hi Ismael,
Thanks for your reply.
No, I didn’t modify the functions-enfold.php file.
As I told you before, I only added a searchform.php file in my enfold-child folder, to transform the classic search to WooCommerce search.
But for now I deleted it to try to find the reason of the display issue. I will put it back in the folder when the issue will be solved.
Please find FTP details in private content.
Best regards.July 15, 2020 at 1:45 pm #1230600Hey!
Thank you for that info.
As I told you before, I only added a searchform.php file in my enfold-child folder, to transform the classic search to WooCommerce search.
That is actually the problem. The script used for the AJAX search depends on the markup inside that form, so you have to revert it back to default if you want to make the AJAX search work again. Unfortunately, you can’t use both WooCommerce and the theme’s default search.
Best regards,
IsmaelJuly 15, 2020 at 11:31 pm #1230773Hi Ismael,
I understand this and I do not want to use both WooCommerce and the theme’s default search.
Now my custom searchform.php file is not anymore in my enfold-child folder, so I think searchform.php from the theme’s folder must be the reference now and search must work correctly, but it doesn’t.
Furthermore, with adding my custom searchform.php file, search used to work perfectly before. I don’t know why it doesn’t work anymore now…July 17, 2020 at 8:21 am #1231130Hi,
We get an error whenever we try to access the file server.
Error: Received unexpected end-of-file from SFTP server
Error: Could not connect to serverPlease contact your hosting provider and ask them if they could configure the SFTP account properly.
The following link contains the default searchform.php file.
// https://pastebin.com/LudYKGHw
Best regards,
IsmaelJuly 17, 2020 at 4:20 pm #1231307This reply has been marked as private.July 19, 2020 at 1:05 pm #1231553Hi Ismael,
For information, I tried to completely delete functions.php and style.css from my child theme, but it still doesn’t work…July 20, 2020 at 10:38 am #1231681Hi,
We get an internal server error 500 whenever we try to search for posts but we are not yet sure why. The site takes quite a while to load and sometimes the image sets are blocked when we check the Network resources, so we can’t debug the site properly. The only difference that we noticed is that the site is using HTTP/2 protocol instead of the default HTTP/1, which is odd because the new protocol is supposed to improve the loading speed of the site. Did you configure the Apache server to use HTTP/2?
Is there a staging or development version of the site? We would like to be able to disable the plugins while doing some tests.
Thank you for your patience.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.