Created
February 14, 2017 21:28
-
-
Save khromov/776d02cf1794c4328eca5076a946b075 to your computer and use it in GitHub Desktop.
Load WPFacet facets from facets.json file in theme
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 | |
//... | |
add_filter( 'facetwp_facets', function($facets) { | |
//Load facets.json file located in theme folder | |
$imported_facets = json_decode(file_get_contents(trailingslashit(dirname(__FILE__)) . 'facets.json'), true); | |
//Import facets | |
foreach($imported_facets['facets'] as $single_facet) { | |
$facets[] = $single_facet; | |
} | |
return $facets; | |
}); | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment