Skip to content

Instantly share code, notes, and snippets.

@djrmom
Forked from anonymous/preselect-current-day.php
Last active January 12, 2018 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djrmom/7bc6c6c4c92e0a5fcd352e570e05589f to your computer and use it in GitHub Desktop.
Save djrmom/7bc6c6c4c92e0a5fcd352e570e05589f to your computer and use it in GitHub Desktop.
facetwp - Attempt to preload the days events using a specific link
<?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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment