Screenflicker

home

Wordpress Plugin: Simple Countdown

18 Jun 2006

Prompted by the countdown on the teaser website for the new Transformers movie I decided to develop a super simple countdown plugin for Wordpress.

This plugin, aptly dubbed Simple Countdown, lets you pick a title for the event or time you're counting down to and merely displays the title along with the remaining days, hours and minutes until the event occurs. The great thing about Simple Countdown is that you can use a plain english date and time, e.g., "next tuesday" or "july 23, 2006 noon"

Download Version 1.0.1

Example:

The details

Usage

Call the plugin with the following code (be sure to remove any extra spaces after the opening "less than" symbol and before the closing "greater than" symbol — WP keeps adding extra spaces when I post/edit this article).

From the sidebar or template file: < ?php cc_countdown('EVENT DATE AND TIME', 'EVENT TITLE', AUTO DELETE); ?>

From within a post: <!--cc_countdown:EVENT DATE AND TIME, EVENT TITLE-->

The title of the event and time remaining until it occurs will both be written to the page wherever the plugin is called.

Parameters

EVENT DATE AND TIME
(string) the date and time of your event can be written many ways, plain text, like the example above, or using digits, e.i., 09/13/2007. When calling the plugin from a post, placing a "-" (dash or minus sign) in front of the EVENT DATE AND TIME will remove the countdown after the date/time has passed.
EVENT TITLE
(string) Just write the title of whatever event is happening in plain text. This will be displayed as an h5 element on your page/template so make sure you've got a nice style for it. When calling the plugin from a post, this is an optional parameter and if added to the tag it can display the title of the event before the countdown. The title will be replaced with an "I'm sorry" message when the event time has passed.
AUTO DELETE
(boolean) Determines whether the countdown should be displayed after the event has occurred. If AUTO DELETE is set to FALSE when the event has passed "(Your event title) has already happened" will display wherever the plugin is called. Default is TRUE.

Version history

Version 1.0.1 — October 27, 2006

Version 1.0 — October 25, 2006

Version 0.4 — July 8, 2006

Version 0.2 — June 18, 2006

Installation instructions

To install Simple Countdown, download the latest version from the top of this page and expand the .zip file. Upload the ms_countdown.php file to your /wp-content/plugins/ directory.

When the file is finished uploading, log into your WP admin page and click on the activate link in line with the Simple Countdown plugin. The plugin is now installed and active.

To show the countdown to whatever event you're counting down to, open up the theme page, such as sidebar.php or single.php, etc. — found in the wp-contents/theme/ folder — in a text editor like TextMate, Dreamweaver or even NotePad.

Once you've located the spot you'd like the countdown to show on that particular page, simple use the usage instructions at the top of this page to display the countdown. Save the file and upload it to your theme directory.

Questions, comments, suggestions

I always welcome questions, comments and suggestions on the WP plugins I release. If there is something you think I should add, let me know. Having trouble with the plugin as it is? I'm here for you. Just want to say thanks? Write about it on your blog.

comments powered by Disqus