Skip to content

Instantly share code, notes, and snippets.

@mrwweb
Created September 25, 2014 22:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrwweb/db2f2808bfd751528df3 to your computer and use it in GitHub Desktop.
Save mrwweb/db2f2808bfd751528df3 to your computer and use it in GitHub Desktop.
"Disabliing AJAX" in Event Views (List, Month, etc.) in The Event Calendar by Modern Tribe
These two files at least seem to disable the AJAX functionality in The Events Calendar by Modern Tribe that interferes with the pre_get_posts action. I was using that to modify the Upcoming and Past Events Lists so I had to find a way to disable the AJAX. Really, the plugin should just work with pre_get_posts, but that's not the case at least for now...
Thanks for the initial idea and starting point from @coreymcollins: https://wordpress.org/support/topic/disable-ajax-pagination?replies=4#post-5204802
This is very very very much a hack, and a sad one at that. It requires overriding the tribe_* paging functions with the core WordPress ones and then blowing away the entire filter bar.
Note the locations these two files go in a theme to override the corresponding files in The Events Calendar.
<?php
/**
* Events Navigation Bar Module Template
* Renders our events navigation bar used across our views
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/modules/bar.php
*
* $filters and $views variables are loaded in and coming from
* the show funcion in: lib/tribe-events-bar.class.php
*
* @package TribeEventsCalendar
* @since 3.0
* @author Modern Tribe Inc.
*
*/
?>
<?php
$filters = tribe_events_get_filters();
$views = tribe_events_get_views();
?>
<?php do_action('tribe_events_bar_before_template') ?>
<?php /* bye bye nav bar :( */ ?>
<?php do_action('tribe_events_bar_after_template') ?>
<?php
/**
* List View Nav Template
* This file loads the list view navigation.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/list/nav.php
*
* @package TribeEventsCalendar
* @since 3.0
* @author Modern Tribe Inc.
*
*/
if ( !defined('ABSPATH') ) { die('-1'); } ?>
<h3 class="tribe-events-visuallyhidden"><?php _e( 'Events List Navigation', 'tribe-events-calendar' ) ?></h3>
<ul class="tribe-events-sub-nav">
<!-- Left Navigation -->
<?php if( tribe_is_past() ) : ?>
<li class="tribe-events-nav tribe-events-nav-left tribe-events-past">
<?php if( get_next_posts_link() ) : ?>
<li class="tribe-events-nav-left">
<?php echo get_next_posts_link( __( '&laquo; Older Events', 'tribe-events-calendar' ) ); ?>
<?php endif; ?>
</li><!-- .tribe-events-nav-previous -->
<?php elseif ( tribe_is_upcoming() ) : ?>
<li class="tribe-events-nav tribe-events-nav-left tribe-events-past">
<?php if( tribe_get_past_link() ) : ?>
<a href="<?php echo tribe_get_past_link() ?>"><?php _e( '&laquo; Past Events', 'tribe-events-calendar' ) ?></a>
<?php endif; ?>
</li><!-- .tribe-events-nav-previous -->
<?php endif; ?>
<!-- Right Navigation -->
<?php if( tribe_is_past() ) : ?>
<?php if( get_query_var( 'paged' ) === 0 ) : ?>
<li class="tribe-events-nav-upcoming tribe-events-nav-right tribe-events-past">
<a href="<?php echo tribe_get_upcoming_link() ?>" rel="pref"><?php _e( 'Upcoming Events &raquo;', 'tribe-events-calendar' ) ?></a>
<?php elseif( get_previous_posts_link() ) : ?>
<li class="tribe-events-nav tribe-events-nav-right">
<?php echo get_previous_posts_link( __( 'More Recent Events &raquo;', 'tribe-events-calendar' ) ); ?>
<?php endif; ?>
</li><!-- .tribe-events-nav-previous -->
<?php endif; ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment