Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Number of results
This topic contains 6 replies, has 2 voices, and was last updated by aspique 5 years, 1 month ago.
- AuthorPosts
- October 8, 2018 at 4:15 pm #19444
Hello,
Is it possible to display the number of results?
And how can I show 200 results while keeping 10 results per “Load more” section?
I also need to find a way to display a warning sentence such as “Your requests generated more than 200 results, we invite you to refine it” (displaying it below results).
October 9, 2018 at 2:27 pm #19465Hi!
Well, that is not possible to change unfortunately. The limit is hard-coded as the number of results to load per batch. Maybe changing the limit to a smaller number, like 50, so that there is still many loaded, but the next batch also comes up with 50 results.
Appending something to the end of the list at reaching a certain number of results might actually be possible with a custom script. I have constructed a custom code that appends a paragraph into the results box when a certain number of results are reached. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
Change the text, search_id and the results_num variables according to your needs.
Please note, that this may not work in all cases, as it is a customization.You can style the text by adding rules to the .extra-text CSS class:
p.extra-text { }
I hope this helps!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 10, 2018 at 12:40 pm #19480Hello,
Thank you for your answer and custom code proposal. But I wish to display this sentence directly already on first batch load, to warn user. Therefore I need a way to know if there are more than 200 results before loading all batches.
This would imply to know if total results are > 200 or not: can you get this information? Or even ideally can you know the total number of results? Which would allow us to display a sentence such as: “Only first 200 results are displayed (out of 348 results). We invite you to refine your requests.”
Is it possible? Many thanks in advance for your feedback.
October 16, 2018 at 1:22 pm #19494Hi!
Unfortunately no, that information is not known and cannot be obtained through a 3rd party script, only within the main script, where the ajax response is done loading and is handled.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 18, 2018 at 11:32 am #19524Ok. But at least, can I manage to display my sentence “Your requests generated more than 200 results, we invite you to refine it” only if there is MORE than 10 results, and not if there is exactly 10 results? This means I would display this sentence only if there’s a “load more” link. Could you please tell me how I could handle this? Many thanks in advance.
October 19, 2018 at 1:58 pm #19545Actually, that could be possible. I made a slight change to the code above. This one will detect if the ‘show more’ link is there, and prepend the text to the results if so:
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 22, 2018 at 1:53 pm #19553Ok cool, thank you for this code update, I’ll use it.
Best,
Tibor - AuthorPosts
You must be logged in to reply to this topic.