Last active
January 18, 2022 13:02
-
-
Save elbotho/cf245b8813f18d9a6887d821c21780ea to your computer and use it in GitHub Desktop.
FacetWP little helper to find active facets from php
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 | |
//helper in functions.php | |
function my_get_facet_vars(){ | |
$vars = []; | |
foreach ($_GET as $key => $value) { | |
$pos = strpos($key, 'fwp_'); | |
if ($pos == 0) { | |
$key = str_replace("fwp_", "", $key); | |
$vars[$key] = $value; | |
} | |
} | |
return $vars; | |
} | |
// and use this to check for active filters | |
if( count($filters) == 0 ) //do stuff; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment