Skip to content

Instantly share code, notes, and snippets.

@djrmom
Created October 5, 2017 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djrmom/4e4ff63b803da56dcb38fa3a0dd4baaf to your computer and use it in GitHub Desktop.
Save djrmom/4e4ff63b803da56dcb38fa3a0dd4baaf to your computer and use it in GitHub Desktop.
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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment