Skip to content

Instantly share code, notes, and snippets.

@nickpish
Last active October 31, 2022 20:11
Show Gist options
  • Save nickpish/34ee4db7bfedc25e9de38b2976d9876d to your computer and use it in GitHub Desktop.
Save nickpish/34ee4db7bfedc25e9de38b2976d9876d to your computer and use it in GitHub Desktop.
Add label element to fSelect facet markup
add_filter( 'facetwp_facet_html', function( $output, $params ) {
if ( 'fselect' == $params['facet']['type'] ) {
$label = '<label for="' . $params['facet']['name'] . '" class="sr-only">Please select a ' . $params['facet']['label'] . '</label>';
$output = $label . $output;
}
return $output;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment