Forked from marktoce/gist:6812bd364b978c629522953d8e974dbb
Last active
August 23, 2016 12:12
-
-
Save mgibbs189/2d9b4566077c5f37bdf77853f9a827dc to your computer and use it in GitHub Desktop.
WPFacet date formating
This file contains 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 | |
function my_facetwp_index_row( $params, $class ) { | |
if ( 'keydate' == $params['facet_name'] ) { // 20170823 | |
$val = $params['facet_value']; | |
$fixed = substr( $val, 0, 4 ) . '-' . substr( $val, 4, 2 ) . '-' . substr( $val, 6, 2 ); | |
$params['facet_value'] = $fixed; | |
$params['facet_display_value'] = $fixed; | |
} | |
return $params; | |
} | |
add_filter( 'facetwp_index_row', 'my_facetwp_index_row', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment