Events plus pagination

Hello, I have created my own archive-incsub_events.php which looks and works great! The issue I have is that I cannot get the pagination working. I have also tried using a custom query:

`$args = array(

'post_type' => 'incsub_event',
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'date',

Can you please tell me what can I do to get the pagination to work? Thanks!

Edit: I can't use shortcodes cos I need to customise the template.

  • Luís

    Hi Graham ,

    Hope you're doing well today and thanks for your patience here!

    During the tests I made, I found some issues in the pagination, so, the best option is using a mu-plugin and change the query using the "pre_get_posts" action:

    function incsub_event_archive_pagination( $query ) {
        if ( is_post_type_archive( 'incsub_event' ) ) {
            $query->set( 'posts_per_page', 10 );
    add_action( 'pre_get_posts', 'incsub_event_archive_pagination', 999 );

    I used 10 post per page, but you can change the value. Then, you just need to add the pagination in the "archive-incsub_event.php", after the loop (after the line "endwhile;"), like:


    If you are interested, I send the mu-plugin used in the tests:

    1) Download the .zip file attached and unzip it;

    2) Using FTP access, upload "change_query_events.php" to "wp-content/mu-plugins".

    Note: If you don't have a "mu-plugins" folder inside the "wp-content", please create it.

    I hope this information has been helpful. If I can help you in this or other questions, please let me know!

    Cheers, Luís