If I were a betting woman, I would bet that WordPress 1.3 (or would it be 2.0?) is releasing sooner rather than later. At least it looks that way from the code, though the developers are going back and forth on a couple of items. Even though I plan on doing my own development from this release on, I’m still interested in WordPress, and plan on being so in the future. After all, my decision to go a new direction has less to do with WordPress and more to do with wanting to try some ideas of my own.
Who knows, maybe some of those ideas will make their way back into WordPress. Life is full of both surprises and variety.
I’ve helped several people move to WordPress, and thought it might be of use to write out the major changes that I’m seeing in this release, and point to any additional information of which I am familiar. That’s the great thing about an open source project that’s being implemented in an open environment – we can all peek in while the work is underway.
Themes
I’ve been using themes over at Kitchen, and just implemented a Theme Switcher, so that the readers can pick their favorite. Ryan Boren wrote an anatomy of a theme, and the WordPress Codex wiki has an overview of how to develop a theme.
From a user perspective, a theme consists of two parts: one or more templates, and an associated stylesheet. The theme template can be as simple as a single index.php, which replaces the one that exists within the weblog root directory; or it can consist of a whole group of template files, such as comments.php, sidebar.php, footer.php, index.php, and so on.
The template files and the stylesheet and any incidental material is placed in it’s own subdirectory under wp-contents/themes/. For instance, one we have at Kitchen is called “Kitchen One”, which is located in a subdirectory called kitchen-one.
When the files are copied into the wp-content/themes directory, they’ll show up automatically within the themes selection list in the new Presentation page within the WordPress administation page. You can then activate whichever theme you want to use. Currently the theme at Kitchen is Kubrick, but that could change tomorrow.
The style sheet is named style.css, and this is critical because the theme name and what pulls it together is found in the stylesheet. The theme definition block for Kitchen One is:
/*
Template: gemini
Theme Name: Kitchen One
Description: A deep warm rich kind of style.
Author: Joni Mueller and Shelley Powers
Author URI: http://itkitchen.info/Odyssey interface and Gemini template for WordPress 1.3 designed and built
by Root http://www.atthe404.com/blog/CSS Design by Joni Mueller http://jonimueller.com/wordpress/ and Shelley Powers
Photo by Elaine Nelson
*/
The values on the left have meaning to the theme system and should be written as shown here. From the top, these provide for the theme name, a description, the author, the author’s web site, and any incidental information. The key variable is the one named ‘Template’. This points to the template being used for the one theme, because one template can be used in many themes. In fact, all the themes at Kitchen use the Gemini template except for one, Kubrick.
In this case, the Gemini theme is a simple one – a single index.php page. For all other functionality, this theme uses the existing default files, such as wp-comments.php. For Kubrick, the theme uses several template files: 404.php, archive.php, archives.php, comments.php, footer.php, header.php, links.php, page.php, search.php, searchform.php, sidebar.php, and single.php.
So how can a system handle one theme that has one file, and other theme that has many? Simple, it checks for the existence of files when a page is accessed, and if the file exists in the theme, it’s used. If not, the default file is used instead.
So for Kubrick, when you access a single entry page using index.php, the application checks to see if there is a single.php page in the template subdirectory. If there is, it loads this; if there isn’t the index.php page handles the request. The same functionalty is used for archives, category, author, searching, and so on.
This is a very effective way of managing file-based templates without having to worry about overwriting a user’s existing modification when you upgrade the application. No more going, “Oh crap, I just copied over the index.php file.”
You can check out the use of templates and themes at Kitchen, and even use the new theme switcher (look at the bottom of the right hand column).
Pages
Another significant change with the next release of WordPress is the existence of pages. A page is like a post except that it’s not included as part of the archives or categories. For instance, the link titled “How to Participate” at the Kitchen is built using the page functionality, not the post. If you click the link, you’ll see it opens at the top-level of the site.
The challenge with a page is that each one requires a new entry within the .htaccess file. So if you want to create a page and have it immediately accessible, you have to make your .htaccess file writeable. Or you have to re-generate the permalink entry for .htaccess every time you create a page.
Still, you’re not going to create that many pages. Rather than make .htaccess writable, I’d recommend creating the pages, and then generating the permalink entries for .htaccess all at once.
There is a new status appearing in WordPress code of ’static’, which makes me wonder if these pages are going to be created using the regular weblog post page and then statically generated – which would make more sense for this type of page. Once one moves past the same problems we’ve had with writing to a directory. Stay tuned…
Paging
Nothing more fun than to go to a weblog that’s been around for years and search on a popular term. What returns is an extremely long page with every entry that matches that search term. If you’re lucky, you’ll only see excerpts. If you’re not, you’re in for a long wait.
WordPress has dealt with the problems associated with too many entries being returned by implementing a thing called ‘paging’. You can see it in the Kitchen, if you access a popular category like Administration, a frequent poster, like The Chef, search on a popular term like weblog, or access an entire month’s entries. At the top and bottom of the page is navigation to go from the current group of posts to the previous, and so on.
The count of posts displayed is based on the same number of posts that you display on the front page of your weblog. You include the navigation bar using something like the following, from the Kubrick theme:
<div class=”alignleft”><?php posts_nav_link(‘’,’’,’« Previous Entries’) ?>&;lt;/div>
<div class=”alignright”><?php posts_nav_link(‘’,’Next Entries »’,’’) ?></div>
At this time, the Gemini template does not have the navigation links. What will happen, then, is that the last specified number of posts show in the results, but there is no navigation for older posts.
Which is a very effective demonstration about how themes can have different behaviors, as well as different appearances and layouts. This has some interesting possibilities for experimentation.
Change is Change
There are some changes that may or may not make it into the finished problem. For instance, the previous nightly build included enclosures, which would automatically pull images and audio files into enclosures in RSS feed. This has subsequently been removed, and hopefully will be implemented as an option.
There is no longer an option to turn auto pinging on or off at the page level, but you’ll want to turn it off for the application, because it’s a performance killer.
There’s a new one that allows users with rank of 9+ to post as another person. Based on this, I’ve updated all the Kitchen writers that were 9 to 8, and changed the menu options accordingly. There’s discussion about turning moderation on automatically for all posts over ten days old, but most of us are doing this anyway. Or closing old posts off completely.
The global variables such as $tableposts are now deprecated, but should be around for at least one release so that old plug-ins won’t break when the application first releases.
There is now a WordPress export, which will be handy if you’re merging weblogs, which I had to do recently. From what I can see, there’s also been improvements in the other imports.
And looks like we’ll be able to have email list management to all users. That’s good news for the Kitchen.
And so on
There are a lot of other changes, many of which take place under the skin so to speak. The development team is working on new comment spam prevention techniques, as well as doing some good code clean up such as moving SQL statements into the functions and out of the pages. The GEO fields have been moved from the administration pages to a plug-in, though I know most people didn’t use this. Then there’s the mysterious Dashboard, but we probably won’t get a peek at that until the tool releases.
All in all, some very tasty additions, with only a few hiccups now and again.
Didn’t notice until today that the WordPress development team released a heads up on 1.3 at the Development weblog November 17th. This lists out some other new features, and confirms the themes and pages additions.