• Resolved Tasos Georgaklis

    (@tasosgeorgaklis)


    Hello,

    I have a problem with the search bar, when I search for products the max numbers of results products that I see its only 10 products.

    https://prnt.sc/2tc5LdehXGUh

    https://prnt.sc/O2Vd1RtDvGk_

    When the results are less than 10 products I see the number correctly. But when the results of products are more than 10, on the result page I see max 10 products.

    I have already deactivate the plugins, update them and see for conflicts.

    Any idea, how to fix the problem?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @tasosgeorgaklis!

    If you have already checked that no plugin is causing this conflict, then the main suspect is the theme. I checked your theme and there is a code that sets the 10 results per page in the search results page in the /rt-framework/functions/theme_functions.php:1100 and if I comment out this line:

    add_filter('pre_get_posts','rtframework_limit_search_results');

    the search results are displaying correctly.

    if( ! function_exists("rtframework_limit_search_results") ){
    /**
    * Limit search results
    * @param string $query
    * @return string $query
    */
    function rtframework_limit_search_results($query) {

    if( is_admin() ){
    return $query;
    }

    if ($query->is_search) {
    $query->set('posts_per_page', 10);
    }
    return $query;
    }
    }
    add_filter('pre_get_posts','rtframework_limit_search_results');

    So I think you should report this to the theme authors. Maybe they will make a fix for you. You can now comment out the line I pointed out and do not update the theme until the fix is ready.

    Regards,
    Kris

    Thread Starter Tasos Georgaklis

    (@tasosgeorgaklis)

    Hello,

    You are right, I changed the line below and now its working.

    			$query->set('posts_per_page', 10);

    How did you know exactly which php file of the theme it was about the number 10 of the posts per page?

    Thank you

    Hi @tasosgeorgaklis.

    Great! Let me know if you get the feedback from the theme authors.

    I checked this using a Query Monitor plugin, which showed me all the functions hooked into the pre_get_post action.

    Regards,
    Kris

    Thread Starter Tasos Georgaklis

    (@tasosgeorgaklis)

    I changes the code by myitself.

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘The search results are max 10 products’ is closed to new replies.