Created
February 24, 2015 13:13
-
-
Save bordoni/c9af7cdced204155a6e7 to your computer and use it in GitHub Desktop.
Ignore past Events on Previous button
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_filters( 'tribe_has_previous_event', 'tec_forum_944441', 11 ) | |
function tec_forum_944441( $has_previous ){ | |
global $wp_query; | |
$has_previous = false; | |
$past = tribe_is_past(); | |
$upcoming = ! $past; | |
$cur_page = (int) $wp_query->get( 'paged' ); | |
$max_pages = (int) $wp_query->max_num_pages; | |
$page_1 = 0 === $cur_page || 1 === $cur_page; | |
// Simple tests based on pagination properties | |
if ( $upcoming && $cur_page > 1 ) $has_previous = true; | |
if ( $past && $cur_page < $max_pages ) $has_previous = true; | |
return $has_previous; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment