-
-
Save BeardedGinger/02054580247c76a7bbce3acac06834e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where do I add this code?