facetwp_sort_html
Overview
This hook lets you customize the old sort box’s dropdown appearance.
Parameters
- $html | string | The sort box output
- $params | array | Associative array of extra variables (see below)
$params = [
'template_name' => 'default',
'sort_options' => [
// See $options within the facetwp_sort_options hook
]
];
Usage
add_filter( 'facetwp_sort_html', function( $html, $params ) {
$html = '<select class="facetwp-sort-select">';
foreach ( $params['sort_options'] as $key => $atts ) {
$html .= '<option value="' . $key . '">' . $atts['label'] . '</option>';
}
$html .= '</select>';
return $html;
}, 10, 2 );