Created
May 24, 2022 21:47
-
-
Save lelandf/8bffdbf07fa2c4d5654fdfdde645c520 to your computer and use it in GitHub Desktop.
[TEC] Ensure searches always occur in list view.
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
<?php | |
add_action( 'wp_footer', function() { ?> | |
<script> | |
jQuery( document ).on( 'afterOnSubmit.tribeEvents', () => { | |
// Select list link | |
const listLink = document.querySelector( '.tribe-events-c-view-selector__list-item--list a' ); | |
// No list link? Stop! | |
if ( ! listLink ) { | |
return; | |
} | |
// Literally click the list link | |
listLink.click(); | |
} ); | |
</script> | |
<?php } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment