Skip to content

Instantly share code, notes, and snippets.

@barryhughes
Created May 23, 2014 14:51
Show Gist options
  • Save barryhughes/bae73fd5489be6a676cf to your computer and use it in GitHub Desktop.
Save barryhughes/bae73fd5489be6a676cf to your computer and use it in GitHub Desktop.
Replacing the existing date filter (Tribe Bar/3.5)
<?php
/**
* Outline for replacing the existing datepicker with a custom filter field.
*
* (TEC 3.5)
*/
add_action( 'init', 'replace_tribe_bar_search_field', 50 );
function replace_tribe_bar_search_field() {
$callback = array( TribeEvents::instance(), 'setup_date_search_in_bar' );
remove_filter( 'tribe-events-bar-filters', $callback, 1, 1 );
add_filter( 'tribe-events-bar-filters', 'replacement_date_field' );
}
function replacement_date_field( $filters ) {
array_unshift( $filters, array(
'name' => 'custom-date-search',
'caption' => 'Date',
'html' => '<input type="text" name="datesearch" value="Some date" />'
) );
return $filters;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment