Getting pagination to work on homepage with WP-Query events listing

Home Forums Calendar Products Events Calendar PRO Getting pagination to work on homepage with WP-Query events listing

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #849218
    brightspark
    Participant

    We are using this script here to show a list of events on our homepage:
    https://theeventscalendar.com/queries-and-pagination/
    However instead We wanted to use in built-in WordPress navigation – but it’s not working. Is there a reason not to use the native WP navigation?

    #849655
    Barry
    Member

    Hi brightspark,

    Our support for custom development tasks like this one is fairly limited but I’d be happy to take a quick peek and see if any issues jump out at me:

    • Can you share your revised code (and let me know which file or files it lives in)?
    • What is going wrong, exactly?

    Thanks!

    #858536
    brightspark
    Participant

    This reply is private.

    #858713
    Barry
    Member

    Hmm, for some reason the first link you provided redirects to the homepage, so I can’t really tell the difference between the two. I do see that there aren’t any standard WP pagination links, though (is that the problem? If so, how are you generating them?).

    #859395
    brightspark
    Participant

    Hi Barry, you must login to see the website. There will be a list of events.

    #859886
    Barry
    Member

    Hi brightspark: yes I did login (logged out all I see is an Under Development message for both the URLs you provided) – what I mean is that, when logged in, the first URL you provided seems to redirect to the second – and so I am unable to compare.

    I hope that makes sense.

    #863780
    brightspark
    Participant

    After a good bit of trial and error I’ve identified this is a bug in Events Calendar PRO.

    WooCommerce had a similar bug last year:
    https://github.com/woothemes/woocommerce/issues/2625

    There is one solid report of the exact same issue here (only posted 10 hours ago)

    https://wordpress.org/support/topic/site-pagination-not-working-after-activate-plugin-the-evevnts-calendar

    On my local instance I’ve got a simple pagination example of a custom post type working fine which then stops working as soon as I activate the pro plugin.

    This is a major bug with the plugin as it impacts ALL custom post types on a given WordPress instance not just their events post type.

    The free version doesn’t have this bug.

    #864460
    Barry
    Member

    Hi brightspark,

    I want to jot down my understanding of the problem, first of all, to make it easier for others (or even my future self!) to quickly get a handle on this issue.

    So, normally, if your front page is set to display your latest blog posts – and of course there are enough of them – WordPress supplies pagination facilities and the resulting URLs look something like this:

    example.com/page/2/

    If I am understanding correctly, the problem you are describing is that if the front page is instead set to display a static page then, even though there is nothing to actually page through, you can use similar URLs like the one above and the same page will still load – allowing your shortcode/customization to take advantage of the pagination information.

    With PRO enabled the problem you seem to be hitting is that accessing the above URL (when your front page is set to show a static page) will result in a redirect to the front page itself, ie:

    example.com

    Is that a fair summary?

    #873736
    Barry
    Member

    Hi again brightspark,

    So I’m going to proceed on the basis that he above is an accurate impression of the problem. It does seem some other users are currently hitting the same issue and I wanted to let you know we are currently investigating.

    It may not actually be a bug in either Events Calendar PRO or WordPress – rather it could be the case that customizations like this one (and themes or plugins that do something similar) are relying on something they shouldn’t be – but we’ll certainly dig in a little further and see if it is appropriate for us to make changes on our end 🙂

    #873800
    brightspark
    Participant

    Hi Barry, We’ve been very busy trying to get the website live and have had to re-design the homepage to avoid using the pagination on the homepage. I haven’t had time to re-respond to the query.

    As we have said: We’ve got a simple pagination example of a custom post type working fine – however this stops working as soon as I activate the pro plugin. It impacts ALL custom post types on a given WordPress instance not just their events post type. The free version doesn’t seem to have this bug.

    #873920
    Barry
    Member

    Yes, I can definitely replicate and I do see it does not occur unless PRO is activated, however I’m not sure it is actually a bug as-such in PRO just at this point.

    We’ll definitely keep you updated, though!

    #876528
    Barry
    Member

    Hi!

    Can you try adding the following code to a suitable location (your theme’s functions.php file should be fine) and see if that helps to mitigate this issue?

    /**
     * Workaround for themes, plugins and customizations that rely on
     * redirect_canonical() *not* redirecting when pagination is used
     * on a static front page.
     */
    add_action( 'init', 'modify_pro_canonical_filter' );
     
    function modify_pro_canonical_filter() {
        if ( ! class_exists( 'TribeEventsPro' ) ) return;
     
        $pro = TribeEventsPro::instance();
        $filter = array( $pro, 'filter_canonical_link_on_recurring_events' );
     
        remove_filter( 'wp', $filter, 10, 1 );
        add_filter( 'template_redirect', $filter, 20, 1 );
    }

    Let me know how you get on!

    #898159
    Barry
    Member

    Hi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!

    (In relation to the issue at hand, we are planning on making a fix in an upcoming release so it should not be necessary to keep the suggested snippet in place forever 🙂 )

    #909472
    Leah
    Member

    Hello,

    I just wanted to update you here and let you know that we have a fix for the issue you reported in our upcoming release. Thank you for bringing it to our attention! Keep an eye out for an update coming soon. If you are still experiencing issues after the update, please start a new thread and we’d be happy to look into it. Thank you for your patience and support while we got this corrected.

    Best,
    Leah

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Getting pagination to work on homepage with WP-Query events listing’ is closed to new replies.