Home › Forums › Calendar Products › Events Calendar PRO › Getting pagination to work on homepage with WP-Query events listing
- This topic has 13 replies, 3 voices, and was last updated 9 years, 4 months ago by Leah.
-
AuthorPosts
-
October 30, 2014 at 2:42 am #849218brightsparkParticipant
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?October 30, 2014 at 7:16 am #849655BarryMemberHi 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!
November 3, 2014 at 2:06 pm #858536brightsparkParticipantThis reply is private.
November 3, 2014 at 4:11 pm #858713BarryMemberHmm, 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?).
November 4, 2014 at 1:15 am #859395brightsparkParticipantHi Barry, you must login to see the website. There will be a list of events.
November 4, 2014 at 7:00 am #859886BarryMemberHi 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.
November 6, 2014 at 12:25 am #863780brightsparkParticipantAfter 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/2625There is one solid report of the exact same issue here (only posted 10 hours ago)
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.
November 6, 2014 at 7:16 am #864460BarryMemberHi 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?
November 10, 2014 at 7:11 am #873736BarryMemberHi 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 🙂
November 10, 2014 at 7:34 am #873800brightsparkParticipantHi 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.
November 10, 2014 at 8:35 am #873920BarryMemberYes, 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!
November 11, 2014 at 6:35 am #876528BarryMemberHi!
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!
November 25, 2014 at 6:51 am #898159BarryMemberHi! 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 🙂 )
December 5, 2014 at 2:20 pm #909472LeahMemberHello,
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 -
AuthorPosts
- The topic ‘Getting pagination to work on homepage with WP-Query events listing’ is closed to new replies.