Add an aria-live=”polite” attribute to a Listing Builder listing template

<?php
// Add an aria-live=”polite” attribute to the <div> with class "facetwp-template", generated by a Listing Builder listing template.

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 );