Intrepid readers may have noticed the link to the “Upcoming Events” on the right sidebar underneath my site search box. What is that you ask? Well, since I’m always posting about shows, and then constantly forgetting about them by the time they roll around, I wanted to devise a way to enter the show as part of a post, and then have it show up magically in a list of upcoming events. So, with that in mind, I created a little hack for WordPress using some php code and the Custom Field Template plugin by Hiroaki Miyashita. If you were wondering how it all works, I’ll give a brief explanation here and a link to all the code you need. First of all download the following two items:
First things first, download and install the Custom Field Template plugin for WordPress. The CFT provides a nice GUI interface for adding metadata to each post which is what drives the event calendar. While you could do what I’m doing without the CFT plugin, it would be much, much more time consuming. Once you’ve got the CFT template installed and activated, you’re going to want to configure it a little in the plugin settings. I’ve got my plugin configured specifically for New York area events, and you can look at download my settings over here, of course feel free to change the options based on where you live. (I think the settings are more or less self explanatory, especially once you look at them in the context of adding a new post.)
Article continued after the jump.
Once you’ve got the settings configured to your liking, install the calendar.php template in your active theme folder (eg. wp-content/themes/youractivetheme) on your webserver. Then the last thing you need to do is add a new page to your blog (Pages-> Add New) and make sure that “Calendar” is set as the default template. You’ll see this setting on the right hand side of your page (see Fig. 2 above). This is very important, if you don’t set the default template to calendar, the event calendar will not work.
Once you’ve configured the Custom Field Template and added the new Calendar page, there really isn’t a lot to do other than commence normal blogging. Just remember though, the next time you add a post that references a future event, add in the details in the custom fields below the post and voila, it will appear on your calendar page like magic. Events are ordered sequentially by date (dates should be formatted like “2009/12/31” or “2009-12-31”) and only future events show up in the calendar. Past events are still available in the database, and adding an archive page would be easy to do, but right now I don’t really see the need for it.
This event calendar isn’t the most robust thing in the world and it’s not meant to be. It’s just a quick little way to keep of track of shows without having to navigate off of the “add new post” page in wordpress. If you’re looking for something a little more hardcore, you might want to check out the Blogs for Bands WordPress Plugin. If there is anything you can think of that might make this calendar better, feel free to let me know in the comments. Enjoy!
A Final Note: When creating an event, I don’t recommend combining a ticketmaster or ticketweb link together with the “other ticket link” textbox. Just use one or the other, if you use both, two “buy ticket” links will show up under the event. If you choose Ticketmaster or Ticketweb as the ticket provider, the calendar performs an automatic search for your show on the respective site. If your show isn’t sold through the Ticketmaster or Ticketweb, then you should use the “other ticket link” textbox and paste the full URL to the ticket purchasing page.
UPDATE: I just added the code to generate a calendar RSS feed to the download package. To activate the RSS feed on your blog, all you have to do is add calendar_rss.php to your theme and then make a new WordPress page with “Calendar RSS” as the default template.