Skip to content

Instantly share code, notes, and snippets.

@djrmom
Created January 25, 2018 22:24
Show Gist options
  • Save djrmom/8cfa0610eba7379926bb5da196c28dd9 to your computer and use it in GitHub Desktop.
Save djrmom/8cfa0610eba7379926bb5da196c28dd9 to your computer and use it in GitHub Desktop.
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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment