Created
January 25, 2018 22:24
-
-
Save djrmom/8cfa0610eba7379926bb5da196c28dd9 to your computer and use it in GitHub Desktop.
facetwp index date as raw value for sorting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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