• Hello, and thanks for the plugin. I have used it successfully on several other sites over the years. I am working on a project where I would like to use paged pagination with The Events Calendar and their new v2 views, but unfortunately wp-pagenavi() doesn’t seem to pull anything. I have tried overriding the events calendar nav.php file, which is where their default pagination occurs. WP-PageNavi fires, but it doesn’t “see” how many events there are to do correct pagination — it’s stuck at one page. Any advice for making this plugin work with The Events Calendar? I’m at a loss for how to get TEC to paginate, which seems like such a basic function. Thanks.

Viewing 1 replies (of 1 total)
  • Thread Starter crawfocl

    (@crawfocl)

    For anyone else who is trying to do this, I got this to work more or less for me. Put this in your appropriate v2 nav.php template file. This example would be for past events but you can edit as needed.

    
    $my_query = new WP_Query( array(
    	'post_type' => 'tribe_events',//Display only event post types
    	'eventDisplay' => 'custom',//Needed to override tribe's modifications to the WP_Query
    	'order' => 'ASC',//Order events by the ones closest to today first
    	'orderby' => '_EventStartDate',//Order events using their start date
    	'paged' => get_query_var('paged'),
    	'meta_query' => array( array(
    		'key' => '_EventStartDate',//Compare using the event's start date
    		'value' => date('Y-m-d H:i:s'),//Compare against today's date
    		'compare' => '<=',//Get events that are set to the value's date or in the future
    		'type' => 'DATE'//This is a date query
    	) )
    ) );
    			
    if(function_exists('wp_pagenavi')) {
    	wp_pagenavi( array( 'query' => $my_query ) ); 
    }
    
    wp_reset_postdata();
    
    
Viewing 1 replies (of 1 total)
  • The topic ‘Usage with The Events Calendar v2’ is closed to new replies.