decompiled

The life and times of Jonathan Kern

WPListCal

WPListCal

Current Stable Version: 1.3.5
Current Development Version: None
Requires WP Version: 2.7
Tested up to WP Version: 3.0-alpha

Download Stable Release

Installation | Usage | FAQ | Changelog | Comments

WPListCal allows you to list upcoming events on your blog in a list or table format.  It plugs straight into the Wordpress admin pages to let you keep track of events just like posts and pages.  You can then list events on a page or post using a shortcode, show events in your sidebar with a widget, or incorporate events into your theme files using a PHP function call.

Documentation and Bugs

Looking for information on how to install and use WPListCal? Did you find a bug in the plugin? Visit the WPListCal Development Site. Please don’t comment on this page for bug reports or feature requests. I won’t accept them here.

Version Guide

WordPress 2.7 or later → Use WPListCal 1.3.5 (current stable release)
WordPress 2.5-2.6.3 → Use WPListCal 1.0.8.2
WordPress 2.0.3-2.3.3 → Use WPListCal 1.0.2

The Future

Through the comments below, I’ve gotten lots of feature requests and bug reports and I appreciate them. I’ll continue development on WPListCal whenever I have time.

On many occasions, I’ve said that version 1.1 will bring support for categories and some other interesting features. I’ve decided to push those features off to 2.0 since the switch to WordPress 2.7 is becoming more than just a sub-point release. Don’t worry though, you don’t have to wait for 1.3-1.9 before I do 2.0…I’ll probably just skip a bunch. This versioning scheme just made more sense than rev’ing the 1.0 tree over and over

Feature Requests

Here is a list of current feature requests that I’ve gotten (and that I remember). Post comments if you have more.

Contributing

Many people have tried to provide code modifications in the comments section below. Sadly, WordPress doesn’t like this much and generally garbles code in comments. If you have a patch that you’d like to submit, please either upload a zip file of it somewhere and link to it, or use pastie and I’ll try to grab it before it expires. Generally, I won’t approve comments with modifications in them since I don’t want to provide support for mod’d versions of WPListCal. That said, if your modification provides significant value and is complete, I’ll seriously consider putting it into the plugin.

Installation

  1. Upload the wplistcal folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

Upgrade

  1. DO NOT DEACTIVATE THE PREVIOUS VERSION OF THE PLUGIN! Doing so could remove all your events.
  2. Upload the wplistcal folder to the /wp-content/plugins/ directory
  3. Deactivate and then activate the plugin in the ‘Plugins’ menu in WordPress

Usage

  1. Change the default settings on the WPListCal options page
  2. If you want to list your events on a page or post, use the [wplistcal] shortcode. Use the parameters in the example below. Leave out parameters to default to the options defined in the WPListCal settings page. (1.2 or later only)
    • Example: [wplistcal display_mode="list" event_format="%NAME%" date_format="M j, Y g:ia" max_events="-1" show_past_events="false" advance_days="-1" event_order="asc" hide_same_date="true" date2_time_format="g:ia" no_events_msg="No events!"]
  3. If you want to list your events on a page or post, insert the tag <!--wplistcal--> in the body of the page/post
  4. If you want to list your events somewhere in your theme files, insert <?php echo wplc_show_events(); ?>. You can set special parameters to overwrite the default options if you use the PHP function call. All parameters are optional, but you must preserve the ordering by passing in `null` for options that you want to use defaults for.
    • Display Mode (string): 'list' or 'table'
    • Event Format (string): The format of the list entries if Display Mode is set to 'list'. You can use the following variables: %NAME%, %LINK%, %LINKEDNAME%, %START%, %END%, %DESCRIPTION%, %AUTHOR%, and %EXPORTURL%.
    • Date Format (string): The format to display the start and end date and time. Uses the same date formatting that Wordpress uses.
    • Max. Events (int): The maximum number of events to display, -1 for unlimited.
    • Show Past Events (boolean): true to show all events, false to show only current and future events
    • Maximum Advanced Notice (int): How many days in advance to display events, -1 for unlimited.
    • Event Order (string): ‘asc’ to show the closest event first or ‘desc’ to show the furthest event first.
    • Hide Same Date (boolean): Format the end date with the format string defined in the next parameter if it is on the same day as the start date.
    • Date 2 Time Format (string): If Hide Same Date is enabled, use this format string for the end date.
    • No Events Message (string): If there are no events, show this string instead, leave blank for none.
    • Example: <?php echo wplc_show_events('list', '%LINKEDNAME%: %START% - %END%{
      %DESCRIPTION%} <a href="%EXPORTURL%">(export)</a>', 'M j, Y g:ia', -1, false, 30, 'asc', true, 'g:ia', 'Sorry, no events'); ?>

Dependent Statements (1.2 or later only)

You can make a statement dependent on the existence of a variable by wrapping it in curly brackets. By default, the statement will only print if the first variable in the statement is not empty. You cannot have nested dependent statements.

Example 1:

The statement in the curly brackets won’t print if %LOCATION% is empty

%TITLE%{ at %LOCATION%} on %START%

Example 2:

To print a literal curly bracket, escape it with ‘^’

%NAME%{ at %LOCATION} ^{new^}

Example 3:

To skip a variable when determining the dependent variable, escape its ‘%’ characters with ‘^’. This method also works to print a literal ‘%’ inside a dependent statement. In this example, the statement in the curly brackets will print if %LOCATION% is not empty. Note that %AUTHOR% will be properly substituted even though it is escaped.

%NAME%{ hosted by ^%AUTHOR^% at %LOCATION%}

Example 4: (invalid)

This example is invalid. You cannot have nested dependent statements.

%NAME%{ at %LOCATION%{ on %START%}}

Example 5:

However, you can have multiple dependent statements in a format.

%NAME%{ hosted by %AUTHOR%}{ at %LOCATION} on %START%

Example 6:

You can also make a statement dependent on a variable without printing the variable. To do so, wrap the variable name in square brackets “[]“. You can escape the square brackets with ‘^’. In this example, the “more” link will only print if there is a description:

%NAME%{[%DESCRIPTION%] <a href="#">more</a>}

Frequently Asked Questions

Where does WPListCal store events?
On activation time, the plugin adds a table called <prefix>_wplistcal that stores all your events.
What happens to my events when I deactivate the plugin?
On deactivation, the events table is dropped, so if you want to save your event data, back up the table before deactivating the plugin.
As of version 1.0.6, deactivation does nothing to your settings and events.
Why is WPListCal different from other Wordpress calendar plugins?
WPListCal is specialized to provide clean list or table based output for you to style or reparse any way you’d like. Other calendar plugins force you to use a gregorian calendar view which may be inappropriate for many applications.
Why do some of my events show N/A for author and create date?
Events created before upgrading to version 1.1 did not have those values set, therefore WPListCal marks them as N/A.
I am unable to make events that start or end past January 19, 2038 at 3:14:08am
This is a known bug in PHP (id# 44209) and was fixed in version 5.2.6. The specific issue was that strtotime() did not support 64-bit timestamps.
Does WPListCal use any 3rd party libraries?
Yes, WPListCal is packaged with iCalcreator which is released under the GNU LGPL
My event times are all wrong after upgrading to WordPress 2.9.
Go to WordPress General settings and reset your timezone to a city rather than a manual UTC offset.
I love WPListCal, but I’d like it to do _______.
Great, I’m glad to hear feature requests. Just post a comment below.
I love WPListCal and I’d like to buy you a beer to thank you.
Awesome, thanks. Just click the big orange Donate button above

Changelog

1.3.5

1.3.4

1.3.3

1.3.2

1.3.1

1.3

1.2.2

1.2.1

1.2

1.1.1

1.1

1.0.8.2

1.0.8.1

1.0.8

1.0.7

1.0.6

1.0.5

1.0.4

1.0.3

1.0.2

1.0.1

1.0

  1. Daniele says:

    After upgrade to 1.3 in WP 2.8.4 IT I found “Cleanup events” and “Export events” not working, giving a message like “You haven’t enough permission to view this page”. Both links seems to call wrong URLs…
    I fixed “on the fly” changing in the code (admin.inc.php) the parameter “page” to “wplc-ops” followed by the proper command, but certainly that’s not the solution.
    Any idea? Thanks!

  2. Aaron says:

    I’m designing a website for my church, and I love your plugin – it works great with ICS Calendar and a tweeked iCal Posts by Gary King (great for when you need to send out email notifications via scheduled posts.)

    My issues:
    1) 1.3 is not letting me export the full list of events to an ICS file. 1.2.2 will let me export.
    2) Ideally it would be nice if it just generated one at a specific address like the iCal Posts plugin so that ICS Calendar could show events on the fly.

    I have the latest version of Wordpress as of this date.

  3. Tad says:

    %END% doesn’t provide any output for events that end of the same day they start.

    • Jonathan says:

      Check the “End Date Options” setting in the WPListCal options page. You can choose the format there or just disable the same-day formatting altogether.

  4. alan says:

    Would like to use this for entering Japanese language events, but have found when saving the text gets scrambled.
    I looked at your table structure and see the wp_listcal table has columns with collation of latin1_swedish_ci instead of the better utf8_unicode_ci

    suggest you might want to change that in future release so people can use double-byte chars.

  5. Daniele says:

    HI,

    I’m looking for an event calendar that lists events in a table with days and time crossed referece. Is WPListCall good for me? is there any page i can see WPListCall at work?

    Thank You,
    Daniele

  6. Michael says:

    is there a way to change the font style?

    • Jonathan says:

      WPListCal is built to be fully stylable via CSS. Just look at the CSS classes on the outputted list/table and you can add the appropriate styles to your theme’s CSS file.

  7. Diego A says:

    Great idea and execution!
    I have one of the strangest problems. Even though I see the correct time and date on the Wordpress admin section, when the dates are published times and dates are modified… Any ideas?

    thanks in advance!

  8. Joshua says:

    Hello Jonathan,

    Great plugin. For our installation, I was required to make a change to the widget functionality. We have multiple widget sidebars and needed more than one instance of the “WPListCal” widget. As a general rule, I always offer back to the developer any changes that I make in hopes that the modifications would be useful to others. If you’d like the modified code, please email me and I will send it to you.

  9. Jonas says:

    Hi!

    Thanks for a great plugin! I’ve just translated WPListCal 1.3 to Swedish and found some minor issues related to localization. The paches show what changes I’ve made to make localization work for me. I’m not a PHP guru (or Wordpress guru either, for that matter) so I can’t vouch for the quality of the code.

    (redacted the URL, this is included in WPListCal 1.3.5)

    Best regards,
    Jonas

  10. Cory says:

    Awesome plugin!

    Here’s a small suggestion — what about a way to print the date in multiple formats? For instance, suppose I want to display the month year and day really big, but I want the time in a smaller font off to the side.

    Anyways, thanks again for this plugin!

  11. Celine says:

    Is it possible to use this for a (recurring) weekly calendar, such as a class schedule? I’d love to be able to use this to keep “day of week” as a subhead and then each day show “course start time” “course end time” “course description” “location” “teacher name” “new”…

  12. Diego A says:

    Thank you for a great plugin.
    I wanted to ask the community about a constant error I’m getting while using WPListCal. Sometimes, dates and times – Hours Get completely distorted when they’re posted online, while they look perfectly fine at the add event section. I’m not sure if this is because of editing an expired event – changing a date for an previous event. I experienced this same error even with new events.
    Thanks every body for any feedback!

  13. Rick says:

    Is Wordpress MU supported? When I click “save” in the WPListCal options page, I get a message which says “cannot find options page”, and of course the changes are not saved.

    This plugin looks great, it would be nice to be able to use it.

    Thanks in advance!

  14. Robin says:

    Any chance of providing an .ics export facility?

    I love this calendar. In WPMU I can enable it so users can post their own events. Although I dont get to do approvals on the back end :)

    • Jonathan says:

      Ya, export is already built in. You can go to the Operations page in the events section of the admin panel and click export to get an iCal file containing all your events. You can export individual events from the event edit page and you can even use the %EXPORTURL% token in your format string to allow export from the frontend.

  15. Chris says:

    Hi there Jon :)

    I got two feature requests i couldn’t file in trac, because it won’t let me register/login:

    1. Maybe you wanna consider the use of date_i18n() instead of date() to display dates in order to make them appear in the language of the blog – i tried this and it works :)
    2. It would be great if one could customize the output of the widget. I use a format string that can’t be used with the shortcode to display events on a page, so i have to define this string in the settings. Because the description is included it is not suitable for the sidebar. I helped myself by defining the format string in the admin.inc.php, where the widget calls wplc_show_events() – maybe you could add some more options to the widget in the next release

    Also I noted a bug:
    When you try to translate the plugin, it somehow doesn’t work. I tried to do it first with poEdit and second with the codestyling localization plugin. poEdit didn’t give me an error and let me compile the .mo-file properly, but in which location ever I tried to save it, WPListCal didn’t recognize it. The localization plugin didn’t even read the strings out of WPListCal in order to generate a .po-File. In this last case I even tried the localization plugin on an older WP installation. It let me translate any other plugin, but not WPListCal.
    I couldn’t find any mistake in your code but still I had to translate it manually in the code itself. Maybe you got an idea on this one.

    Thanks in advance :)
    Chris

    PS: Great plugin ;)

    • Jonas says:

      Hi Chris!

      I’ve recently translated WPListCal to Swedish and ran into the same issues you did and I have a working patch for the latest version of WPListCal.
      I respect Jonathan’s decision not to approve comments with contributed code so I will not attempt to post it here, but I can email it to you or post it some where else if you like to take a look at it.

      Sincerely,
      Jonas

  16. paul says:

    So I love the plugin, one of the few calendar plugins that works simply and really well.

    One Bug:

    When you list past events, it puts them in order from the oldest event first, followed by the newer events. Switching between options in the settings panel does not modify how they are laid out.

    I’ll let you know if I can tinker around and find a fix to this.

    Thanks!

  17. Alarick says:

    Does somebody knows how to translate the plugin to another language??

  18. Scott says:

    Hello – I love this plug-in! Any way to add these two features?

    1) Allow the widget to be installed in multiple sidebars. Currently it can only be installed in one sidebar.

    2) Add a recurring events option. If you have recurring events, you have to add them one-by-one.

  19. CA says:

    Hello,

    Actually I’m testing under XAMMP (1.7.3, with PHP 5.3.1) and with Wordpress 2.9.1.

    I would like to list the events on a page, but the syntax like in the example or like this one:
    [wplistcal display_mode="list", date_format="d.m.Y", event_format="%LINKEDNAME% - %START%{ (%DESCRIPTION%)}"]
    seems not to work.

    The date oft the event takes the default format, which I set to “d.m.” (for the sidebar).

    It seems than more then two arguments for [wplistcal] do not work properly.

    Examples:
    [wplistcal display_mode="list", date_format="d.m.Y"]
    works fine: linked-eventname – DD.MM.YYYY

    [wplistcal display_mode="list", event_format="%LINKEDNAME% - %START%{ (%DESCRIPTION%)}"]
    works as intended: linked-eventname – DD.MM. (description if any)

    [wplistcal display_mode="list", date_format="d.m.Y", event_format="%LINKEDNAME% - %START%{ (%DESCRIPTION%)}"]
    or
    [wplistcal display_mode="list", event_format="%LINKEDNAME% - %START%{ (%DESCRIPTION%)}", date_format="d.m.Y"]
    do not works!

    Regards
    CA

  20. Torbjorn says:

    Hi

    Is it possible to make WPListCal write the names of days and months in an other language than English? I want it write the names in Norwegian.

    Thanks.

  21. Hello Jonathan,

    I work for the Federal University of Santa Catarina (Brazil) and we are using your plugin to one of our institutional websites.

    I want to contribute some fixes we made to adapt your code to wordpress 2.7+ recommendations.

    The changes can be seen here:
    (redacted, the patch is being added for WPListCal 1.3.5)

    and here are de reference documentation:
    http://codex.wordpress.org/Creating_Options_Pages#settings_fields_Function

  22. Rob Carruthers says:

    Would it be possible to have the list output separated into months, so we can style each month to make them stand out in a long list of events.

  23. Jonathan says:

    FYI, WPListCal 1.3.5 has been released. Enjoy!

  24. Jonathan says:

    Also, go check out my other plugin, Keep it Fresh!

Have your say



XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

If you want literal < and/or >, use &lt; and &gt; instead.