Last active
June 12, 2018 17:41
-
-
Save elimn/308b6a6a6259d4ac3b6b to your computer and use it in GitHub Desktop.
MT | TEC | Prevent Next/Prev pages from being loaded via Ajax in List and Month views
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 | |
/* | |
* Prevents Next/Prev pages from being loaded via Ajax in List and Month views | |
*/ | |
function tribe_prevent_ajax_paging() { | |
echo " | |
<script> | |
jQuery(document).ready(function(){ | |
// Tribe Bar | |
jQuery( 'form#tribe-bar-form' ).off( 'submit' ); | |
jQuery( '#tribe-events' ) | |
.off( 'click', '.tribe-events-nav-previous, .tribe-events-nav-next' ) // Month and Week View | |
.off( 'click', '.tribe-events-nav-previous a, .tribe-events-nav-next a') // Day View | |
.off( 'click', '#tribe-events-footer .tribe-events-nav-previous a, #tribe-events-footer .tribe-events-nav-next a' ); // Day View | |
// Month View | |
jQuery( 'body' ).off( 'click', '#tribe-events-footer .tribe-events-nav-previous, #tribe-events-footer .tribe-events-nav-next' ); | |
// List View | |
jQuery( '#tribe-events-content-wrapper' ) | |
.off( 'click', 'ul.tribe-events-sub-nav a[rel=\"next\"]' ) | |
.off( 'click', 'ul.tribe-events-sub-nav a[rel=\"prev\"]' ) | |
.off( 'click', '#tribe-events-footer .tribe-events-nav-previous a, #tribe-events-footer .tribe-events-nav-next a' ); | |
/* This breaks map and Photo view as of v4.0, because their nonJS href='#' | |
// Map and Photo View | |
jQuery( '#tribe-events' ) | |
.off( 'click', 'li.tribe-events-nav-next a') | |
.off( 'click', 'li.tribe-events-nav-previous a'); | |
*/ | |
}); | |
</script>"; | |
} | |
add_action( 'wp_footer', 'tribe_prevent_ajax_paging', 99 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment