Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wpcom/infinity 22feb17 #6480

Merged
merged 2 commits into from
Feb 23, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/infinite-scroll/infinity.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ static function got_infinity() {
static function is_last_batch() {
$entries = (int) self::wp_query()->found_posts;
$posts_per_page = self::get_settings()->posts_per_page;

// This is to cope with an issue in certain themes or setups where posts are returned but found_posts is 0.
if ( 0 == $entries ) {
return (bool) ( count( self::wp_query()->posts ) < $posts_per_page );
}
$paged = self::wp_query()->get( 'paged' );

// Are there enough posts for more than the first page?
Expand Down