FacetWP – Brunch Pro (theme) fix

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php
/**
* The Brunch Pro theme uses a widget for its /recipe-index/ page.
* It uses “showposts” instead of “posts_per_page” for the result counts,
* which is deprecated and breaks FacetWP. This hook fixes that.
*/
add_filter( ‘facetwp_query_args’, function( $query_args, $class ) {
if ( isset( $query_args[‘showposts’] ) ) {
$query_args[‘posts_per_page’] = (int) $query_args[‘showposts’];
unset( $query_args[‘showposts’] );
}
return $query_args;
}, 10, 2 );

{{/gist}}