Skip to content

Commit 2e25149

Browse files
committed
Enable ghosts for checkbox facet
1 parent 30ff21f commit 2e25149

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

a11y-add-on-for-facetwp.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,9 @@ function a11y_addon_transform_facet_markup( $output, $params ) {
9393
// Leaving that class and attribute on the wrapping list item resulted in two events being fired when the label was clicked.
9494
$output = '';
9595
foreach( $params['values'] as $value ) {
96-
if( $value['counter'] > 0 || ! $params['facet']['preserve_ghosts'] === 'no' ) {
97-
$output .= sprintf(
98-
'<div class="facetwp-checkbox-wrapper">
99-
<input type="checkbox" id="%3$s"%1$s value="%2$s" class="facetwp-checkbox%1$s" data-value="%2$s">
96+
$checkbox = sprintf(
97+
'<div class="facetwp-checkbox-wrapper %6$s">
98+
<input type="checkbox" id="%3$s"%1$s value="%2$s" class="facetwp-checkbox%1$s" %6$s data-value="%2$s">
10099
<label for="%3$s">
101100
<span class="facetwp-display-value">%4$s</span>
102101
<span class="facetwp-counter">(%5$d)</span>
@@ -106,9 +105,11 @@ function a11y_addon_transform_facet_markup( $output, $params ) {
106105
esc_attr( $value['facet_value'] ),
107106
'checkbox-' . esc_attr( $value['term_id'] ),
108107
esc_html( $value['facet_display_value'] ),
109-
$value['counter']
108+
$value['counter'],
109+
$value['counter'] == 0 ? 'disabled' : ''
110110
);
111-
}
111+
112+
$output .= $checkbox;
112113
}
113114
break;
114115

0 commit comments

Comments
 (0)