apply_filters ( 'infinite_scroll_query_args', array $query_args )

Filter the array of main query arguments.

Source file: modules/infinite-scroll/infinity.php

View in GitHub

Parameters

$query_args

(array) Array of Query arguments.


Changelog

Since: Jetpack 2.0.1


Notes

Some themes and plugins add extra arguments to post queries, often to change the way the posts are sorted or loaded. You can use the infinite_scroll_query_args filter to add those extra arguments to Infinite Scroll as well. In the example below, we’ll add 2 custom ordering parameters, order and orderby:

/**
 * Sort all Infinite Scroll results alphabetically by post name
 *
 * @param array $args
 * @filter infinite_scroll_query_args
 * @return array
 */
function jetpack_infinite_scroll_query_args( $args ) {
	$args['order']   = 'ASC';
	$args['orderby'] = 'name';

	return $args;
}
add_filter( 'infinite_scroll_query_args', 'jetpack_infinite_scroll_query_args' );

Have a note to contribute?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s