Last active
April 19, 2018 15:29
-
-
Save djrmom/a739026e2bf177d491fc5ffd7ec072fe to your computer and use it in GitHub Desktop.
facetwp preselect
This file contains hidden or 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 | |
add_filter( 'facetwp_preload_url_vars', function( $url_vars ) { | |
if ( 'demo/cars' == FWP()->helper->get_uri() ) { | |
if ( empty( $url_vars['make'] ) && empty( $url_vars['other_facet'] ) ) { | |
$url_vars['make'] = array( 'audi' ); | |
$url_vars['other_facet'] = array( 'something' ); | |
} | |
} elseif ( 'demo/otherpage' == FWP()->helper->get_uri() ) { | |
if ( empty( $url_vars['make'] ) && empty( $url_vars['other_facet'] ) ) { | |
$url_vars['make'] = array( 'audi' ); | |
$url_vars['other_facet'] = array( 'something' ); | |
} | |
} | |
return $url_vars; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment