Temporary fix: handle ACF date fields (YYYYMMDD)

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

function fwp_index_acf_date( $params, $class ) {
if ( ‘vandring_startdatum’ == $params[‘facet_name’] ) {
$raw = $params[‘facet_value’];
if ( 8 == strlen( $raw ) ) {
$date_fixed = substr( $raw, 0, 4 ) . ‘-‘ . substr( $raw, 4, 2 ) . ‘-‘ . substr( $raw, 6, 2 );
$params[‘facet_value’] = $date_fixed;
$params[‘facet_display_value’] = $date_fixed;
}
}
return $params;
}
add_filter( ‘facetwp_index_row’, ‘fwp_index_acf_date’, 10, 2 );

{{/gist}}