Musings and technical explanations from Aldosoft.

It’s not uncommon for a website to want to have different sidebars on different pages, different “sections” of the site. When you use a traditional WordPress theme this is easy to accomplish, just create a new page template and away you go.

The Thesis theme for WordPress doesn’t work like that, you don’t have page templates in the same sense. You can create custom page templates in code, in the custom_functions.php file, but that’s relatively heavyweight for something that seems so simple, just changing the sidebars for certain pages of the site. And if Thesis is so powerful, shouldn’t it be easy?

[click to continue reading…]

{ 32 comments }

Thesis Custom Loop Starter Template

by Alderete on January 20, 2011

As an addition to my article on How to Use the Thesis Custom Loop API, here is a Custom Loop starter template you can use for your own loops. Every loop you can customize in Thesis 1.8 is stubbed in, and comments before each method provide helpful reference information. All you need to do is replace the one-line stub methods with your own custom loop code. You can delete any loop method you’re not customizing, or leave them in place for the future; they simply apply the appropriate default Thesis loop.

[click to continue reading…]

{ 16 comments }

How to use the Thesis Custom Loop API

by Alderete on January 17, 2011

In the latest release of the Thesis theme for WordPress a new feature for advanced theme customization was added called the Thesis Custom Loop API. The Thesis User’s Guide explains the basics of how to use the Custom Loop API. This article expands on that documentation, offering additional context to explain what the Custom Loop API is, what it’s good for, and examples of how to use it.

Wait! There’s more! I’ve written a follow-up to this article, Thesis Custom Loop Starter Template, which provides a complete custom loop class ready for you to customize, along with useful helper methods and additional explanations.

A Bit of WordPress and Thesis Background

To understand what the Thesis Custom Loop is, we need to take a step back, and look at just WordPress. Setting aside plugins for a moment, before the Thesis theme, there was only one way to alter the HTML and contents of your site’s theme: hack away on the theme files themselves. And once you started hacking on your copy of a theme’s files, it became a real challenge to update to a newer version of that theme.

Among other innovations, the Thesis theme made it possible to customize the theme extensively without altering the theme’s files. By isolating theme customizations into a few files in the thesis/custom directory, it became easy, almost trivial to update to newer versions of the theme. (These days child theme functionality is built into WordPress, but it works differently than Thesis, overriding theme files directly, rather than with an API, so it’s not relevant here.)

Thesis achieved this by moving the vast majority of the theme’s code out of standard WordPress theme files and into libraries and classes in the Thesis core code, and weaving into it the Thesis API—the hooks and filters we know and love.

With Thesis, you don’t hack away on the theme files, because there is nothing there. (Check out the thesis/index.php file, it has one line of code.) Instead of altering the HTML and WordPress Loop code directly, you use the hooks and filters to re-order, remove, or alter the various pieces of the Thesis HTML, post content, metadata about those posts (tags, categories, author, etc.), and so on.

What is the Thesis Custom Loop API?

If you have worked with Thesis much, at this point you’re thinking “I know all this, but what does it have to do with the Custom Loop API?”

Standard WordPress theme files don’t merely contain HTML and content tags, they also contain The Loop. The Loop is the heart of WordPress output, and it is how WordPress acquires, processes, and iterates through a set of posts (or pages, etc.) to convert them from database table rows to e.g. your blog’s home page.

When Thesis moved the contents of theme files from the files themselves to functions and classes inside Thesis, it also moved The Loop. While you can use hooks and filters to alter the HTML that Thesis generates when processing The Loop, before Thesis 1.8 there was no (good) way to use anything but a standard WordPress Loop on a Thesis site.

The Thesis Custom Loop API opens that up again. A cynic might say it just returns a built-in WordPress feature that was taken away by earlier versions of Thesis, but actually the Thesis Custom Loop can be a much cleaner way to work with The Loop. We’ll see how in a bit.

[click to continue reading…]

{ 18 comments }

The release of the iPhone OS 4.0 developer beta has a lot of people working themselves into a lather (another) over changes in the iPhone developer program agreement, which have the effect of banning applications not created using the native development tools. More specifically, cross-compiled Flash applications (among others).

I’ve got three thoughts about the changes, but they basically amount to “big effing deal.” You can talk or blog about it all you want, but I think it’s all hot air (including this post ;-), and we should all just get back to work.

The King Makes the Rules

First, it’s Apple’s platform, and just like every sovereign nation gets to make their own laws, Apple gets to make the rules for how people get to participate. If you want to create native applications and distribute through the App Store, you follow the rules. Period.

There are important, strategic, and rational reasons why Apple doesn’t want to allow a cross-platform framework like Flash to become powerful on their platform. These reasons are based on long experience with Adobe (more here), and with cross-platform frameworks for the Mac.

You may not like it, but it’s hard to argue that Apple doesn’t have the right to do as they please.

There is Already a Permitted Cross-Platform Framework

Second, any developer who wants to build a cross-platform mobile application, that works on iPhone, Android, Blackberry, etc., can do so today, using technologies that Apple doesn’t just permit, they actively support. HTML5, CSS, and JavaScript run very well on the iPhone, Android, and Palm’s webOS, and any other mobile platform of importance.

Why would any developer whine about being locked into Apple’s platform, and then turn around and tie themselves to Adobe’s proprietary Flash platform? At least Apple is aggressively driving their platform forward; Flash performance on anything but Windows PCs has been abysmal for many years, with only a few signs of change, and only recently, under competitive threat.

Let the Market Decide

Finally, if you’re so offended by Apple’s position that you can’t just develop using open standards like HTML5, you feel the need to “punish” Apple, well… go for it. Android, Blackberry, webOS, and soon Windows Mobile 7 all have developer programs and app stores, and offer a range of alternative models for how to manage and control a mobile platform.

Instead of ranting on your blog or crying in your beer, get coding for the platform that best fits your idea of how the vendor should build and manage their ecosystem. Go be a part of their success, and prove that your preferred model works.

If you turn out to be right, you can be sure Apple will notice, and adapt. (Posting angry words on your blog, not so much.)

{ 1 comment }

Using Typekit with the Thesis Theme for WordPress

2 December 2009

The Thesis theme for WordPress offers excellent typography out of the box. But, like anything else on the web, it is limited in the number of fonts that it can reliably support, because there are not very many “web safe” fonts out there. TypeKit is a new service that promises to change that. This document explains how to use TypeKit with Thesis to enable more interesting typography on your Thesis-powered WordPress web site.

Read the full article →

Aldosoft Relaunched

25 November 2009

Two weeks ago I relaunched the Aldosoft web site, improving both the visual design and the code behind it, and adding a blog for posts like this one. This article is a brief description of the technical changes and additions.

Read the full article →

Applying Thesis styles in print

11 November 2009

Although Thesis is the most advanced WordPress theme available, it does not provide a print stylesheet, and so web pages print completely unstyled. This is a problem that is easily solved with Thesis’s customizability, and a few lines of CSS.

Read the full article →

Making Your WordPress Blog Appear in a Non-Root Folder

8 August 2009

It’s easy to use WordPress to build an entirely static content site, based on Pages. The setting for changing the Home page from a list of Posts to a static Page is easy to find, and obvious in use. But moving the blog to the same level as other sections of the site is not so obvious. There are multiple related settings, and even the WordPress Codex page on the topic is out-of-date.

This article documents the simplest approach required to build a site like this one, a basic mostly-static WordPress site, where the blog is not the focus of the home page, but pushed down to the same secondary “non-root” level as all the other pages.

Read the full article →

Installing PostgreSQL server and Ruby gem on Mac OS X

22 April 2009

How to compile and install both the PostgreSQL relational database server and the associated Ruby database driver for Postgres, for doing Ruby on Rails development with PostgreSQL on Mac OS X 10.5 “Leopard”.

Read the full article →