Last active
January 5, 2022 18:47
-
-
Save dcooney/2a4369bb7b2361a73539646a6ace6c49 to your computer and use it in GitHub Desktop.
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 | |
// id: team_filter, key: category | |
add_filter('alm_filters_team_filter_category', function(){ | |
// Define empty array | |
$values = []; | |
// Get all categories | |
$args = array( | |
'order' => 'ASC', | |
'orderby' => 'name', | |
'exclude' => '1' | |
); | |
$terms = get_categories($args); | |
// Loop terms | |
if($terms){ | |
// Add All Item | |
$values[] = array( | |
'label' => 'View All', | |
'value' => '' | |
); | |
foreach( $terms as $term ) { | |
$values[] = array( | |
'label' => $term->name, | |
'value' => $term->slug | |
); | |
} | |
} | |
return $values; // Return values | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment