I've finally taken the leap and migrated the blog to WordPress 1.5 "Strayhorn".
My connection sweat blood trying to upload all the files via FTP (damn FileZilla, which sometimes drops the connection to the server mid-upload), but the thing is finally running in production.
The main reason for upgrading hasn't just been the novelty of being able to create static pages (something WP desperately needed so as not to depend on loose HTMLs on the FTP), but the new theme system.
Goodbye Spaghetti Code, Hello Modular Architecture
If you've touched previous versions, you'll know that changing the visual design was a pain in the neck: you had to modify the main index.php in the root, hardcode the entire design in there, and cross your fingers that upgrading the version wouldn't break anything.
Now, the WordPress folks have modularized everything. They've put themes in a separate folder (wp-content/themes/) and divided the structure into several files. Suddenly, this makes architectural sense. You find a header.php, a footer.php, a sidebar.php, and a clean index.php, strictly for the post loop.
Putting "The Loop" to the Test
To give you an idea of what coding looks like now, I've been tinkering to adapt my template, and it looks something like this in the index.php:
<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<div class="meta">
Publicado el <?php the_time('j \d\e F \d\e Y') ?> por <?php the_author() ?>
</div>
<div class="entry">
<?php the_content('Leer el resto de la entrada »'); ?>
</div>
</div>
<?php endwhile; else: ?>
<p>Vaya, parece que aquí no hay nada.</p>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Look at the elegance of using native functions like get_header() or get_sidebar(). No more manual PHP include()s with relative paths that break at the slightest change. The core handles finding the corresponding file inside your current theme folder. If header.php is missing, it does an automatic fallback to the default one.
CSS Challenges: Web Standards vs Internet Explorer 6
Another thing that drove me crazy at first is the style.css. I set out to build the theme without tables, entirely based on <div>s and CSS, following the web standards and XHTML fever. However, getting the floats to line up in Internet Explorer 6 is still torture. If you put a float: left; on the sidebar, IE6 doubles the margin right to your face (the famous double margin bug). I had to rely on the classic display: inline; hack so the visual setup wouldn't fall apart.
But the technical curiosity here is how WordPress reads this CSS. It now parses the commented header of the stylesheet to display the theme name directly in the admin panel. You absolutely have to put something like this at the beginning of the file:
/*
Theme Name: Clean 2005
Theme URI: http://url.com/
Description: Tema minimalista en XHTML y CSS adaptado para WP 1.5
Author: fulano
Version: 1.0
*/
If you skip this literal comment, the control panel won't recognize your template, it won't show up in the "Presentation" tab, and you're left looking foolish thinking you uploaded the files wrong via FTP. It took me almost half an hour to realize this silly detail.
The Future of WordPress as a Content Management System
Honestly, I think this architectural change is going to mark a before and after. Separating the heavy core logic from the presentation layer is something we had been screaming for. I can already see that themes are going to start coming out in droves across the net, ready to download, upload, and activate with a click.
With this flexibility, WordPress is going to stop being just a "script for weblogs," and many people will start using it as a full-fledged content management system. Let's see what the future holds, but if PHP keeps heading this way (and they don't mess it up) and shared servers can endure the load, we've got a toy for a long time.
Let's play.