• Resolved Kipperlenny

    (@kipperlenny)


    If you use random sort (offset == 0, limit == 8, number of posts in backend == 12) in a post grid with load more button, the load more button is not working.

    This is because of the SQL created in /wp-content/plugins/essential-addons-for-elementor-lite/includes/Traits/Helper.php line 72.

    I added an if statement around:

    
    if(empty($args[ 'orderby' ]) || $args[ 'orderby' ] != 'rand') {
    	$args[ 'offset' ] = (int)$args[ 'offset' ] + ( ( (int)$_REQUEST[ 'page' ] - 1 ) * (int)$args[ 'posts_per_page' ] );
    } else {
    	unset($args[ 'offset' ]);
    }

    because RAND sorting with post__not_in will already exclude the posts you don’t want to see anymore. A offset for the query is not needed anymore (in fact, it will not show the next posts).

    my change with make the “LIMIT 8,8” in the sql to “LIMIT 8”.

    • This topic was modified 3 years, 6 months ago by Kipperlenny.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Mahbub Shovan

    (@mahbubshovan)

    Hello @kipperlenny
    Hope you are doing good.

    Thanks for pointing out this issue. We have already found the issue and our team working on it.
    Could you please allow us some more time for the fix and we will release a new version with the fix as soon as possible? I will try to provide the dev version here when it’s ready.

    Thank You.
    Have a nice day.

    • This reply was modified 3 years, 6 months ago by Mahbub Shovan.
    Plugin Support Mahbub Shovan

    (@mahbubshovan)

    Hi @kipperlenny,
    Hope you are doing well.

    Could you please remove your free plugin and upload this one now – https://d.pr/f/VrRNjG and install it. Here I have shared the dev version for you and will release a new version with the fix as soon as possible.

    Check the load more issue now and let me know how it goes.

    Thank You.
    Have a nice day.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post Grid Load More not working with RAND Sort’ is closed to new replies.