djrmom
1/25/2018 - 10:24 PM

facetwp index date as raw value for sorting

facetwp index date as raw value for sorting

<?php

add_filter( 'facetwp_index_row', function ( $params, $class ) {
    if ( 'my_facet' == $params['facet_name'] ) { // change 'my_facet' to the name of your facet
        $params['facet_value'] = get_the_date( 'Ymd', $params['post_id'] );
    }
    return $params;
}, 10, 2 );