Skip to content

Instantly share code, notes, and snippets.

@erishel
Created June 13, 2018 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erishel/abac63d3a82f87c57d2003776171bcd6 to your computer and use it in GitHub Desktop.
Save erishel/abac63d3a82f87c57d2003776171bcd6 to your computer and use it in GitHub Desktop.
Fix AJAX issues with The Events Calendar and some themes
<?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 );
?>
@jennieeweb
Copy link

Hello, I have add this snippet to my functions.php on child theme in https://www.e20gratis.it/eventi/ but does not work :(

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