FacetWP – convert EU-based date to YYYY-MM-DD

mgibbs189

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

function fwp_format_date( $params, $class ) {
if ( ‘my_date_facet’ == $params[‘facet_name’] ) {
$date = explode( ‘.’, $params[‘facet_value’] );
$date = implode( ‘-‘, array_reverse( $date ) );
$params[‘facet_value’] = $date;
$params[‘facet_display_value’] = $date;
}
return $params;
}
add_filter( ‘facetwp_index_row’, ‘fwp_format_date’, 10, 2 );
{{/gist}}