Posts in the WordPress Category

Feeling Distracted

Published 14 years, 1 month ago

For no apparent reason other than I can, I’ve redone the sidebar to include a linkblog titled “Distractions.”  I did this by grabbing Markku Seguerra‘s wp-recent-links plugin and then hacking the holy bejeezus out of it.  I needed to add a “via” function, for example, and wanted to make the administrative interface a bit nicer.  That involved finding out how MySQL statements work (mostly by finding all the ways they don’t).  So, hack hack hack.  It was an interesting distraction.  I’ll make the files available in due course.

To make room, I took out the “Socialization” section because it seemed largely worthless; two of the services listed I hardly even look at any more, and the other one was mostly about me puffing up my ego in public, which nobody really needs to see.  I’m also thinking about taking out the Platelets because I don’t get to update it often enough, even though I have really soft spot for it in my heart.  We’ll see what happens.

Keen-eyed observers will notice that I backfilled a few entries from the past few days.  I needed test data, you know?

Migration Patterns

Published 14 years, 3 months ago

I’ve fielded a few questions about my experience migrating from Movable Type to WordPress, so I thought I’d address that subject for anyone else who might be interested.  I didn’t migrate from Movable Type.  I’ve never run Movable Type.  Okay?  That’s not saying anything for or against MT.  I’ve just never used it.

What I was using before setting up WordPress was a completely hand-built system where I authored entries in an XML format of my own devising, in which every entry for a given period (say, all of 2004) was sitting the same file.  Once I wrote a new entry, I’d pour the XML file through a set of XSLT scripts to generate the latest posts, monthly archive pages, and RSS feeds.  This was accomplished with some dirt-simple shell scripts I’d put together.  Here’s what the main script looked like:

MONTH="$(date +%Y%m)"
echo $MONTH
xsltproc -o latest.html xslt/latest.xsl archive.xml
xsltproc -o rss20.xml xslt/rss20.xsl archive.xml
xsltproc -o rss091.xml xslt/rss091.xsl archive.xml
xsltproc -o $MONTH.html -stringparam chunk $MONTH xslt/chunker.xsl archive.xml

Anyone familiar with xsltproc will see what I’m doing at a glance.  For the rest of you, here’s a quick explanation.  The first xsltproc... line runs xsltproc using the script at xslt/latest.xsl (relative to the shell script) against the file archive.xml, writing the result to the file latest.html.  That’s it.  Nothing very fancy, but it worked well enough when I created the system.

Why did I abandon my loving crafed system for an installable package?  A combination of factors, any of which would not have been enough on its own.

  • The monthly archives were starting to get too heavy.  For example, the archive page for March 2004 is 88KB, and that doesn’t count any style sheets, images, or other external resources that would have to be loaded on top of that.  Back in the day, a month’s worth of posts would be maybe 15KB of HTML and text.  Heck, all of my posts from 1999 and 2000 total a whopping 32KB of HTML source.  My total posting from December 1999 through 2001 is about the same amount of data as the posts for March 2004.  So I needed more flexibility in terms of post archiving, which meant things like per-post archives, which I didn’t really want to have to try to support via XSLT.
  • I wanted to offer post commenting from time to time, and also have a system that managed pingbacks and trackbacks.  I had very little interest in figuring out how to implement my own commenting system, so weblogging software was my best choice.
  • An ability to search through the post archives was something I wanted to add, but for some reason I don’t want to do it through Google.  I’m still not sure why… I just don’t.

So why did I migrate to WordPress, specifically?  After looking at a number of packages, I decided that WordPress just fit me the best.  I still don’t like having to go through a Web interface to write posts, as I’ve gotten very used to authoring in BBEdit, but that was going to be a hurdle no matter what.  (And I do often write up a post in BBEdit before simply pasting it into the Web interface.)  Here are some specific reasons:

  • By default, WordPress generates valid XHTML files.  Thus, the process of adapting its code to generate the valid HTML I wanted was a lot less painful than it would have been with a package that doesn’t generate valid markup by default.
  • Similarly, WordPress is set up to handle site presentation via CSS, so it was a trivial matter for me to replace their default styles with my own.
  • I like that WordPress is not only open source, but users are encouraged to hack on it and share their hacks, which I’ve already started to do.  This was enough like a hand-built system to make me happy.  I think of it as a stock car that I can tune and tinker with to my heart’s content.
  • The new “Import via RSS” feature in WordPress 1.2 made sucking all of my back posts into the system really, really easy.  I just had to create a full-content RSS file containing every post I’d ever written—pretty easy, given that I had them all stored in XML—and then point the RSS importer at the file.  Well, two files, actually, but it still made the whole process very smooth.  It read the publication dates, categories, and everything else of note in a matter of milliseconds.  In fact, it was so easy I felt no regret about blowing away my test-site import and doing it again for the public site.
  • It certainly didn’t hurt that one of the primary forces behind WordPress is Matt Mullenweg, a fellow GMPG founder, so I knew that if I really got stuck I could ask him for help.

So that’s why I switched away from my home-brewed system and onto WordPress.  So far, aside from the occasional bouts of swearing at obscure MySQL and PHP syntax, neither of which has been anywhere near as migrane-inducing as XSLT syntax was, I’ve had no significant reason to regret the change.

Now you know… and knowing is half the battle.

Plugging Into WordPress

Published 14 years, 3 months ago

Although I’m now using WordPress for the “Thoughts From Eric” portion of the site, that doesn’t mean I’m using a default install.  Oh no.  I had to go hacking on the source of the system, even though I knowknew next to nothing about PHP (not that it seems terribly difficult to learn) and bend it to my desires.  No, not those kinds of desires.  The HTML it produced wasn’t suited to my needs, so I changed it.  I didn’t like the limitations of some functions, so I extended them.  I needed a more robust monthly calendar, so I added what I needed.  I thought the administrative interface could provide better visual feedback, so I hacked on it until I could do things like highlight activated plugins in varying shades of green.

Since WordPress now supports plugins, I figured I’d share some of what I’ve created in case anyone out there is interested.  Thus, I now have a WordPress Plugins and Hacks page in the Tools area of meyerweb.  The three plugins currently given there are the three I wrote first, and which work the way I wanted.  Each plugin has a page that documents the parameters it can accept, which is a good way to decide if a given plugin will be of any use to you or not.  I have a few more plugins that are almost, but not quite, ready for public release; hopefully I’ll have them sorted out within the next couple of weeks.

So feel free to check out my WP plugins, and to use ’em if you like ’em.