Pagination or paging through many events

This events or calendar plugin offers various ways to ‘page’ or navigate events in time.  One can also navigate or filter by other ways(categories, taxonomies, authors etc):

  1. semi-pagination(vary days, events, start date)

    semi-pagination

    semi-pagination

  2. look for more” – a simpler google style link

    Look for more events

  3. use the month navigation dropdown form or links

    month dropdown and links

  4. or do your own with html, using the query parameters
  5. ‘Plug’ the semi-pagination function (advanced php users only)

semi-pagination

  • I like to call it “semi-pagination” because it is not normal pagination like the WordPress listing of posts.  Normal pagination has one parameter – the number of pages and the number of events.   Event lists need two ‘drivers’
    1. a time period – the number of days, weeks, or months
    2. the number of events to show
  • It is dynamically generated based on the parameters you used.  If you used days, then it will use days etc
  • The text will be translated if the language translation exist
  • Its links allow the user to vary
    • the time periods
    • the number of events
    • and when to start (ie one can go back and forward in time)
  • Switch it on/off by adding the parameter  to the shortcode:
    • [events pagination=1] or [events pagination=0]

 

Look for more

a simpler google style “look for more”

  • also dynamic in that it will remember the last date displayed and will offer a link to view more events from that date on
  • The default text will be translated if the language translations exist.
  • the text can be customised in the settings.  Multi language sites should leave the default text and rather use the translation files.  To do this for english  see “an accent for your website”
Look for More events

Look for More

Month navigation

  • These appear by default in some list types
  • Can be switched on/off with parameters
    • show_month_nav=1
  • Can be added manually by using additional shortcodes before / after 
    • [month_year_dropdown] – displays the month and year drop down box where ever you put the shortcode.
    • [month_prev_next] – displays the next and previous month links where ever you put the shortcode – eg: after the events shortcode maybe? eg [month_prev_next][events]
    • Note some additional shortcodes only available with amr-events plugin.  For the free version see ‘write your own html links’ below.)

Write your own html links

Linking to the event list and passing parameters, one can alter the display.  Use the offset parameters to shift the start of the display, either forwards or backwards in time

  • startoffset=n, or startoffset=-n
  • daysoffset=n, or daysoffset=-n
  • monthsoffset=n, or monthsoffset=-n

To show more or less events, or other components the parameters that could be useful, possibly in combination are:

  • days=n
  • months=n
  • hours=n
  • events=n

Examples:

Next Month   Previous Month

Next 30 days   Previous 30 days

Show more days   Show more events

  • Add the html before or after the shortcode in your page html.
  • This html cannot be translated as it is straight html
  • See the html generated by the pagination code as a starting point:
Pagination Html

Pagination Html

Plug the semi-pagination function

If you are considering this option. You should

  • know php well,
  • know what a pluggable function is
  • and know how the plugin uses the various time and number of event parameters to navigate through time

See the existing function amr_semi_paginate in amr-ical-events-list/includes/amr-pluggable.php.  Note the global variable to receive the parameters or limits used.

First published Jan 2010, now updated and republished.

About anmari

the developer at anmari
This entry was posted in How To. Bookmark the permalink.