Home › Forums › Calendar Products › Events Calendar PRO › Non-AJAX Previous Events / Next Events Links
- This topic has 3 replies, 2 voices, and was last updated 11 years, 11 months ago by
Barry.
-
AuthorPosts
-
May 21, 2014 at 11:30 am #169319
Marty
ParticipantI have been working on updating a site from the 2.x to 3.x versions of the plugin. One thing I’ve encountered is the change in the way the the previous/next pagination links are constructed. Whereas before they were something like “/past/page/2/”, now they’re “/upcoming/?action=tribe_list&tribe_paged=2”.
The default ECP theme uses AJAX to load the new page of posts. I don’t want to bother with AJAX, however. I just want to output a link to “?action=tribe_list&tribe_paged=3” or similar.
Do you have any example code for nav.php which outputs this string?
Thanks!
May 22, 2014 at 2:33 pm #170831Barry
MemberHi!
I’m afraid we don’t have any example code for that – but you could certainly make use of these filters to change things:
- tribe_get_past_link
- tribe_get_upcoming_link
Or, if you prefer a different approach, you could customize and remove the existing nav links via a template override – taking list view as an example, that might mean setting up a custom list/nav.php and adding your own custom code in there to form the links.
Sorry we can’t offer much more on this one, but do check out the Themer’s Guide if you haven’t already done so for an overview of the basics when theming The Events Calendar 🙂
May 22, 2014 at 2:58 pm #170865Marty
ParticipantThanks for your response. Can you help me get a bit further?
As-is, the tribe_get_past_link() and tribe_get_upcoming_link() functions aren’t doing the full job of providing back/next links, since they don’t include the “?action=tribe_list&tribe_paged=3” string.
In order to write alternatives to those functions, where would I get the variable to use with “paged=”?
Thanks!
May 23, 2014 at 6:42 am #171869Barry
MemberOK, so the existing logic is contained exclusively in our Javascript (in the case of list view, that means tribe-events-ajax-list.js) and you can certainly refer to that to see how things are currently handled – but really to do what you need you’re going to have to create a PHP implementation and I’m afraid we can’t write that for you.
Here’s an example though outlining the basics of setting up a filter for the next link:
add_filter( 'tribe_get_upcoming_link', 'my_custom_next_events_link' ); function my_custom_next_events_link( $base_link ) { $page = 1; // Expand this with your own logic, of course return add_query_arg( 'tribe_paged', $page, $base_link ); }In terms of figuring out what the current page is you would need to inspect the URL query for the current request:
$current_page = isset( $_GET['tribe_paged'] ) ? absint( $_GET['tribe_paged'] ) : 1;There isn’t too much more help we can provide for a customization like this one I’m afraid (and so I’ll go ahead and close this thread), but I hope that helps and at least gives you a basic outline you can build upon 🙂
-
AuthorPosts
- The topic ‘Non-AJAX Previous Events / Next Events Links’ is closed to new replies.
