Number of results

This topic contains 6 replies, has 2 voices, and was last updated by aspique aspique 3 years, 9 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #19444
    aspique
    aspique
    Participant

    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).

    #19465
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #19480
    aspique
    aspique
    Participant

    Hello,

    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.

    #19494
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #19524
    aspique
    aspique
    Participant

    Ok. 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.

    #19545
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Actually, 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 :)


    #19553
    aspique
    aspique
    Participant

    Ok cool, thank you for this code update, I’ll use it.
    Best,
    Tibor

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.