Skip to content

Instantly share code, notes, and snippets.

@BeardedGinger
Created June 21, 2016 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BeardedGinger/02054580247c76a7bbce3acac06834e5 to your computer and use it in GitHub Desktop.
Save BeardedGinger/02054580247c76a7bbce3acac06834e5 to your computer and use it in GitHub Desktop.
add_action( 'wp_footer', function() {
// If tribe-events.js hasn't been setup, do nothing
if ( ! wp_script_is( 'tribe-events-calendar-script' ) ) return;
print "
<script type='text/javascript'>
jQuery( document ).ready( function( $ ) {
if ( 'object' !== typeof tribe_ev ) return;
var existingSearch = tribe_ev.state.url_params;
$( tribe_ev.events ).on( 'tribe_ev_collectParams', function() {
if( existingSearch != tribe_ev.state.url_params ) {
window.location = tribe_ev.data.cur_url + '?' + tribe_ev.state.url_params + '&eventDisplay=list';
}
} );
} );
</script>
";
}, 100 );
@bryanjowens
Copy link

Where do I add this code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment