facetwp – Attempt to preload the days events using a specific link

djrmom

{{gist file=”preselect-current-day.php” lang=”php”}}
<?php

// Attempt to preload the days events using a specific link
// Link URL should be structured this way http://mercerspace.com/events/?today=true
function fwp_preload_facets( $url_vars ) {
if( ‘events’ == FWP()->helper->get_uri() && isset( $_GET[‘today’] ) && empty( $url_vars ) ) {
$url_vars[‘event_dates’] = array( date( “Y-m-d” ) );
}
return $url_vars;
}
add_action( ‘facetwp_preload_url_vars’, ‘fwp_preload_facets’ );
{{/gist}}