FacetWP includes built-in accessibility (a11y) support, but it’s disabled by default.

Enable accessibility support

Enable the Load a11y support setting.
Enable the Load a11y support setting in Settings > FacetWP > Settings.

To enable accessibility support, browse to Settings > FacetWP > Settings, and enable the “Load a11y support” setting.

Translate the Pager facet’s aria labels

When the “Load a11y support” setting is enabled, the “page numbers” Pager facet type will have three aria-label attributes in its code: “Go to page #”, “Go to next page” and “Go to previous page”.

These aria labels can be translated with the internationalization function __(), or with the WordPress gettext filter, as demonstrated in this code example.

Enable accessibility support programmatically

To enable FacetWP’s built-in accessibility support programmatically, add the following to your (child) theme’s functions.php:

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( 'facetwp_load_a11y', '__return_true' );

Note that this does not override the setting. If either the setting is enabled, or the above hook returns true, accessibility support will be enabled.

Add an “aria-live” attribute to a listing

The following code snippet adds an aria-live=”polite” attribute to the <div> with class facetwp-template, generated by a Listing Builder listing template:

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( 'facetwp_shortcode_html', function( $output, $atts ) { if ( isset( $atts['template'] ) ) { $output = str_replace( 'class="facetwp-template"', 'class="facetwp-template" aria-live="polite"', $output ); } return $output; }, 10, 2 );

In WP archive templates or custom WP_Query templates, you can add the attribute manually in your template file.

See also