Skip to content

Instantly share code, notes, and snippets.

@marktoce
Created August 19, 2016 12:20
Show Gist options
  • Save marktoce/6812bd364b978c629522953d8e974dbb to your computer and use it in GitHub Desktop.
Save marktoce/6812bd364b978c629522953d8e974dbb to your computer and use it in GitHub Desktop.
WPFacet date formating
// The keys correspond with columns in the `facetwp_index` table
$dateparams = array(
'facet_name' => 'keydate'
);
//change the way the date works for key date on calendar page
function my_facetwp_calendar_row( $dateparams, $class ) {
if ( 'keydate' == $dateparams['facet_name'] ) {
$raw_value = $dateparams['facet_value'];
$dateparams['facet_display_value'] = date( 'm/j/Y', strtotime( $raw_value ) );
}
return $dateparams;
}
add_filter( 'facetwp_calendar_row', 'my_facetwp_calendar_row', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment