jenny-r
10/5/2017 - 5:30 PM

facetwp different posts per page on initial load

facetwp different posts per page on initial load

<?php
/**
 ** requires at least 3.0.4
 **/
add_filter( 'facetwp_query_args', function( $query_args, $class ) {
	if ( 'posts_template' == $class->ajax_params['template'] && empty( $class->facets ) && $class->is_preload ) {
		$query_args['posts_per_page'] = 1;
	}
	return $query_args;
}, 10, 2 );