Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mgibbs189/2d9b4566077c5f37bdf77853f9a827dc to your computer and use it in GitHub Desktop.
Save mgibbs189/2d9b4566077c5f37bdf77853f9a827dc to your computer and use it in GitHub Desktop.
WPFacet date formating
<?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