As of version 3.6.0, the plugin allows you to set a custom term order while editing the grid filter. Under “Filter Terms” set the “Term Order” setting to “Custom Order”. This will get you a new “Custom Terms Order” tab that shows all the terms for this filter and allows you to drag and drop them to reorder:
Setting a custom term order using custom code
A fully custom filter term order is also possible by using custom code and making use of our different filter plugin hooks.
The code examples below can be added to your theme’s functions.php file, but take note that you’ll have to adjust them to your situation. Taxonomy, grid and term names will have to get changed.
Changing the term order for the isotope filter
function wpupg_filter_isotope_buttons( $buttons, $filter, $grid, $args ) {
// Uncomment the var_dump to find out the current order of the buttons.
//var_dump( $buttons );
// This array can be reordered or reconstructed before returning it again.
return $buttons;
}
add_filter( 'wpupg_filter_isotope_buttons', 'wpupg_filter_isotope_buttons', 10, 4 );
The key used in the $buttons array can be ignored when just changing the order.
Changing the term order for the dropdown filter
function wpupg_filter_dropdown_terms( $term_output, $filter, $grid, $args ) {
// Uncomment the var_dump to find out the current order of the buttons.
// var_dump( $term_output );
// This array can be reorder or reconstructed before returning it again.
return $term_output;
}
add_filter( 'wpupg_filter_dropdown_terms', 'wpupg_filter_dropdown_terms', 10, 4 );
$term_output is a multidimensional array to account for parent child terms. Key “0” will get output as parents. Any other keys will need to use the ID of the parent that this term should be under. When there are no parent-child terms, you only need key “0”.
Changing the term order for the checkboxes filter
function wpupg_filter_checkboxes_terms( $term_output, $filter, $grid, $args ) {
// Uncomment the var_dump to find out the current order of the buttons.
// var_dump( $term_output );
// This array can be reorder or reconstructed before returning it again.
return $term_output;
}
add_filter( 'wpupg_filter_checkboxes_terms', 'wpupg_filter_checkboxes_terms', 10, 4 );
Uses the same structure as the dropdown filter. See above.