Last active
March 14, 2023 11:22
-
-
Save wpmark/fd11b424b3e7207c824ecf190a6af16f to your computer and use it in GitHub Desktop.
Register Facets with the excellent FacetWP plugin via 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 | |
/** | |
* Registers the Facets with FacetWP. | |
* | |
* @param array $facets The current array of registered facets. | |
* @return array $facets The modified array of registered facets. | |
*/ | |
function hd_utility_add_job_facets( $facets ) { | |
// add the job industry facet. | |
$facets['job_industry'] = array( | |
'name' => 'job_industry', | |
'label' => __( 'Job Industry', 'hd-utility' ), | |
'type' => 'checkboxes', | |
'source' => 'tax/hd_job_industry', | |
'parent_term' => '', | |
'modifier_type' => 'off', | |
'modifier_values' => '', | |
'hierarchical' => 'yes', | |
'show_expanded' => 'no', | |
'ghosts' => 'no', | |
'preserve_ghosts' => 'no', | |
'operator' => 'or', | |
'orderby' => 'count', | |
'count' => '-1', | |
'soft_limit' => '10', | |
); | |
// return the maybe modified facets. | |
return $facets; | |
} | |
add_filter( 'facetwp_facets', 'hd_utility_add_job_facets', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment