Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Register Facets with the excellent FacetWP plugin via PHP
<?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', 'srgroup_utility_add_job_facets', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment