If you spend any kind of time out in public, doing stuff, you’ll appreciate that keeping your calendar not only up to date, but accessible is important.
For example; I’ve been getting out and doing stuff more often lately (and this will continue in the future), and I wanted to display this information here on my site. for a while, I just edited text in my footer (pictured to the right) – but that’s not sustainable, really, and not efficient.
Then, I read this tutorial from Devin Price (@devinsays on Twitter), explaining how to build a Custom Post Type into WordPress 3.0 to handle events. Perfect!
Here’s how it works, in short. You’re going to need a little knowledge of WordPress theme development to get this done – or have access to someone who knows. I’d call this a “intermediate” difficulty task – you need to know your way around, but don’t need to know too much.
It all hinges around code in two files (and one image for nice display). I’ve included a download link at the end of this post.
The code in the events-function.php file needs to be added to your WordPress theme’s functions.php file. Here’s what it does:
- Adds a custom post type called “Events” to your WordPress backend.
- Changes some of the admin info within the post editor to better suite the Events post type
- Modified WordPress defaults so that posts in the future (scheduled posts) can be displayed
- Note: You, or whoever is doing this adjustment for you, will have to modify the path to the calendar-icon.gif file, otherwise it won’t appear.
The code in the events-display.php file can be added to your theme wherever you want to display your events. As it’s set up now, it does the following:
- Grabs the four Events with the highest date numbers (most recent or farthest in the future)
- Displays the date and the content of the Events entry
- Note: This code comes right out of my theme, you’ll need to style the Events area to suit your own site.
That’s it for theme modification – not terribly difficult at all. But here’s where it gets really interesting.
Some WordPress plugins to amazing things on their own – and some of them jump through some really awesome hoops at unexpected times.
Install the Editorial Calendar plugin for WordPress – this helps schedule posts, and normally lets you keep a better handle on your posting schedule. However, with the Events post type set up, something interesting happens. Because we’ve set the Events post type to “post” – the Editorial Calendar plugin fires for our Events!
The result of having both the Events post type – whether you display your events or not – and the Editorial Calendar plugin amounts to a super-simple, portable, personal event organizer.
There’s a lot of opportunity to expand on this which I’ve intentionally not taken – changing the display code to show the next three events, for example (for people with many more events than me), or setting up a taxonomy to display only events labelled “Public” on the blog, and keep “Private” appointments from showing up. One could even build an entire events calendar page template, to do the job the Editorial Calendar plugin does in the back end, and let site visitors see all your events, past and future.
I stopped where I did with my work on this because, for now, this does exactly what I wanted it to. What else would you add to this?
Download the code (and the image) – and make sure you give @devinsays a shout-out for the handy stuff!