Created
October 5, 2017 17:30
-
-
Save djrmom/4e4ff63b803da56dcb38fa3a0dd4baaf to your computer and use it in GitHub Desktop.
facetwp different posts per page on initial load
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment