Properties

$the_time

$the_time

Initialize our static variables

$settings

$settings

$option_name_enabled

$option_name_enabled

Methods

__construct()

__construct() : null

Register actions and filters, plus parse IS settings

Returns

null

get_settings()

get_settings() : object

Parse IS settings provided by theme

Returns

object

wp_query()

wp_query() : object

Retrieve the query used with Infinite Scroll

Returns

object

got_infinity()

got_infinity()

Has infinite scroll been triggered?

is_last_batch()

is_last_batch()

Is this guaranteed to be the last batch of posts?

preserve_more_tag()

preserve_more_tag( $array)

The more tag will be ignored by default if the blog page isn't our homepage.

Let's force the $more global to false.

Parameters

$array

settings_api_init()

settings_api_init() : null

Add a checkbox field to Settings > Reading for enabling infinite scroll.

Only show if the current theme supports infinity.

Returns

null

infinite_setting_html()

infinite_setting_html()

HTML code to display a checkbox true/false option for the infinite_scroll setting.

action_template_redirect()

action_template_redirect() : null

Does the legwork to determine whether the feature is enabled.

Returns

null

enqueue_spinner_scripts()

enqueue_spinner_scripts()

Enqueue spinner scripts.

body_class()

body_class( $classes)

Adds an 'infinite-scroll' class to the body.

Parameters

$classes

get_last_post_date()

get_last_post_date() : string

Grab the timestamp for the initial query's last post.

This takes into account the query's 'orderby' parameter and returns false if the posts are not ordered by date.

Returns

string —

'Y-m-d H:i:s' or false

get_query_sort_field()

get_query_sort_field( $query) : string

Returns the appropriate `wp_posts` table field for a given query's 'orderby' parameter, if applicable.

Parameters

$query

Returns

string —

or false

query_time_filter()

query_time_filter(string $where, object $query) : string

Create a where clause that will make sure post queries will always return results prior to (descending sort) or before (ascending sort) the last post date.

Parameters

string $where
object $query

Returns

string

posts_per_page_query()

posts_per_page_query(object $query) : null

Let's overwrite the default post_per_page setting to always display a fixed amount.

Parameters

object $query

Returns

null

has_wrapper()

has_wrapper() : bool

Check if the IS output should be wrapped in a div.

Setting value can be a boolean or a string specifying the class applied to the div.

Returns

bool

ajax_url()

ajax_url() : string

Returns the Ajax url

Returns

string

ajax_response()

ajax_response()

Our own Ajax response, avoiding calling admin-ajax

action_wp_head()

action_wp_head()

Alias for renamed class method.

Previously, JS settings object was unnecessarily output in the document head. When the hook was changed, the method name no longer made sense.

action_wp_footer_settings()

action_wp_footer_settings() : string

Prints the relevant infinite scroll settings in JS.

Returns

string

action_wp_footer()

action_wp_footer() : string

Provide IS with a list of the scripts and stylesheets already present on the page.

Since posts may contain require additional assets that haven't been loaded, this data will be used to track the additional assets.

Returns

string

filter_infinite_scroll_results()

filter_infinite_scroll_results( $results,  $query_args,  $wp_query) : array

Identify additional scripts required by the latest set of IS posts and provide the necessary data to the IS response handler.

Parameters

$results
$query_args
$wp_query

Returns

array

query()

query() : string

Runs the query and returns the results via JSON.

Triggered by an AJAX request.

Returns

string —

or null

allowed_query_vars()

allowed_query_vars(array $allowed_vars) : array

Update the $allowed_vars array with the standard WP public and private query vars, as well as taxonomy vars

Parameters

array $allowed_vars

Returns

array

get_taxonomy_vars()

get_taxonomy_vars() : array

Returns an array of stock and custom taxonomy query vars

Returns

array

inject_query_args()

inject_query_args(array $query_args) : array

Update the $query_args array with the parameters provided via AJAX/GET.

Parameters

array $query_args

Returns

array

render()

render() : string

Rendering fallback used when themes don't specify their own handler.

Returns

string

archive_supports_infinity()

archive_supports_infinity() : bool

Allow plugins to filter what archives Infinite Scroll supports

Returns

bool

footer()

footer() : string

The Infinite Blog Footer

Returns

string —

or null

filter_grunion_redirect_url()

filter_grunion_redirect_url(string $url) : string

Ensure that IS doesn't interfere with Grunion by stripping IS query arguments from the Grunion redirect URL.

When arguments are present, Grunion redirects to the IS AJAX endpoint.

Parameters

string $url

Returns

string

get_request_path()

get_request_path() : string|bool

Build path data for current request.

Used for Google Analytics and pushState history tracking.

Returns

string|bool

get_request_parameters()

get_request_parameters() : string

Return query string for current request, prefixed with '?'.

Returns

string

default_footer()

default_footer() : string

Render default IS footer

Returns

string