Last active
October 28, 2019 13:04
-
-
Save djrmom/7b998e3966403b3f446f271d87268f1a to your computer and use it in GitHub Desktop.
facetwp change template query args by url
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 | |
/** change the query args according to page. Page is always the without the domain and without starting and ending / | |
** demo/cars or something/something or my-page | |
**/ | |
add_filter( 'facetwp_query_args', function( $query_args, $class ) { | |
if ( 'my-page' == FWP()->helper->get_uri() ) { | |
$query_args['post__in'] = [ 2 ]; | |
} elseif ( 'other-page' == FWP()->helper->get_uri() ) { | |
$query_args['post__in'] = [ 2,3,7,9 ]; | |
} | |
return $query_args; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment