• Resolved ilove@112

    (@bobbyng)


    Hi, Thank you for your plugin.

    I have a question about the pagination. I used a custom template to show eight event posts above the event calendar and I’d like to show all of the events no matter It was past. So, I created a query to retrieve it.

    I tried:

    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    $my_query = new WP_Query(array(
        'post_type'     => 'tribe_events',
        'posts_per_page'=> 8,
        'start_date' => "1990-01-01 00:00:00",
        'paged'         => $paged,
    ));
    

    However, when I added the pagination code at the end of the wrapper. It didn’t work.
    This is the theme pagination function.

    <?php gullu_pagination(); ?>

    then I’ve tried the method refer to Here

    
    <?php $args = array(
        'base'               => '%_%',
        'format'             => '?tribe_paged=%#%'
    ); ?>
    <?php echo paginate_links( $args ); ?>
    

    and it also didn’t work.

    Also, I’ve tried other coding like:
    stack

    The above method was able to show a arrow and link to next page, but there is nothing inside the second page… I have created nine demo events.

    How can I retrieve all the events? Please give me some advice, thanks.

Viewing 1 replies (of 1 total)
  • Thread Starter ilove@112

    (@bobbyng)

    Oh, sorry. I knew where the problem was.

    It is because I was not using the global query variable $wp_query. Therefore, the theme pagination function was not working.

    Also, I changed the query to below so it can retrieve all the event.

    
    $wp_query = new WP_Query(array(
        'post_type'     => 'tribe_events',
        'posts_per_page'=> 1,
        'paged'         => $paged,
        'start_date' => "1990-01-01 00:00:00",
        'eventDisplay' => 'custom',
    ));
    
Viewing 1 replies (of 1 total)
  • The topic ‘Show pagination in custom template’ is closed to new replies.