Blog Pile

Calendar Data PITA and Banging On WordPress

Remember the “S” in RSS standing for Simple? I’ve gone through several gyrations [1] [2] [3] in trying to leverage RSS-ified calendar data to push content to a blog.

Calendar information is just not as neatly boxed like Title, Link, & Description.

What I wanted is a web-based calendar tool (lots of them), that I could give others editing rights, went beyond the fill-out-forms-click-repeat process, and it would not only generate a normal calendar view, but also an events listing suitable for a blog side bar. What I really sought as something that would list both upcoming events and past events.

Google calendar certainly fills out the needs for the front end.

The closest for the sidebar publishing was the iCal-events plug-in for WordPress, which could use the iCal data format published by gCalendar. What’s nice is it bad built in caching scheme, so it was not hitting gCalendar for every page load. It had the ability to sort future and past events differently, although I think that an events past calendar should list them in order with the most recent, and then receding in time (this plugin listed the oldest, and moved forward). I thought some simple hacking of the loop controls might get me there, but I only succeeded in making rivers PHP errors.

The real rub was that gCalendar allows you to have “no-time” events that span, say 2 weeks- they appear as a nice solid bar across a calendar, indicating an extended event. however, the iCal-events plugin saw this as a new event every day, and thus my sidebar listing 5 newer events was blasted full. I tried to hack a way for it to list just once (had some better luck, but not optimal). The other route would require making it a daily repeated event, which is apparently tagged differently in iCal format (and if you think XML is scary looking, just try to put your eyes on iCal data, yuck).

I was happy with the GCalendar tools to put the month view in my page (example) and realized I was trying just too damn hard to list 5 upcoming events in a sidebar.

The solution was just to drop the RSS/iCal syndication, and create a mini WP template file that was just the content I wanted (in HTML list format style), use a PHP include statement in the sidebar template, and just edit it by hand. Not as automatic, but does the job.

On other WordPress hack-age fronts, I spent a large chunk of time setting up some web forms that are inside my WP site. Well, not really, since they are actually my own PHP pages, but use the WP set up tools to have them use the WP header and footer. It’s rather easy, just top the PHP file with:

This way I get my custom content wrapped in my same blog header, footer, styles, etc. This way I can run my own forms, like

And this created some weird problem with the PodPress plugin, requiring a modification (oops, looks like it was fixed in a later version, another update to do).

The next thing was trying to incorporate these handspun web pages into a WordPress Page (big “p”) so it could be one of the top navigation links on each page. This required a plugin to allow some PHP code, and a custom page template so I could include the sidebar on the pages… and some tweaks to the header.php template so they would not use the single column main layout… and re-adjusting of some of the original content so it would display as static content.

The trick is here that my WordPress Page passes the form processing to my custom one at (the latter can also be an entry point as well).

And then I find out the WordPres’s autoformatting decides to put its own <br /> tags around my form’s SELECT elements, event after taking the entire form and yanking all line breaks. Weird. Some another bit go googling found the TextControl plug-in, that allows you, per post, or per-Page, to turn off Autoformatting (or use those other things like TextPattern….).

It’s all pretty complex now, but I am excited about the feel. Especially when minutes after posting our new features, we got a nice comment from one of principles at Electric Sheep Company. This in turn turned up a bug in the Blix template ours is based on (I have seen this boo-boo on lots of WP templates), that the Comments template (comments,php) uses the wrong ID class for each comment, so the WordPress generate links don’t clip down to the comment. This is yet another simple edit, change line 28 from


As it was, the ids used to mark each comment would just use a number that references the number of the comment within the post, while WP generates links to the comments based on database IDs.

All in a day’s banging on the blog.

Which I thought was my morning 2 hour task ;-)

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon