Skip to content

Instantly share code, notes, and snippets.

@annelyse
Created June 4, 2021 14:51
Show Gist options
  • Save annelyse/58a294d66900bd0f2d805f47fd8628e8 to your computer and use it in GitHub Desktop.
Save annelyse/58a294d66900bd0f2d805f47fd8628e8 to your computer and use it in GitHub Desktop.
function categoryListing($taxonomy, $orderby, $order) {
$term_args = array(
'orderby' => $orderby,
'order' => $order,
'hide_empty' => true,
);
$terms = get_terms($taxonomy,$term_args);
if ($terms) {
foreach($terms as $term) {
echo '<div class="form-group">';
echo '<input type="checkbox" value="'.$term->term_id .'" id="filter-'. $term->slug .'">';
echo '<label for="filter-'. $term->slug .'">' . $term->name . '</label>';
echo '</div>';
}
}
}
echo categoryListing('lignes', 'menu-order', 'asc');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment