Created
June 13, 2018 01:43
-
-
Save erishel/abac63d3a82f87c57d2003776171bcd6 to your computer and use it in GitHub Desktop.
Fix AJAX issues with The Events Calendar and some themes
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 | |
/* | |
Plugin Name: Events Calendar Pagination Fix | |
Plugin URI: https://tri.be | |
Description: Fix pagination issues with TEC and certain themes | |
Author: Modern Tribe (Ed) | |
Version: 1.1 | |
Author URI: https://tri.be | |
License: GPL2 | |
*/ | |
function tribe_prevent_ajax_paging() { | |
// The only function we have. We are basically stopping AJAX functionality to resolve issues with pagination with TEC | |
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' ); | |
}); | |
</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
Hello, I have add this snippet to my functions.php on child theme in https://www.e20gratis.it/eventi/ but does not work :(