What’s In a Name: Duster

A lot of people have been asking where the name for the Duster theme came from. I love naming themes (it’s probably something that warrants a post of it’s own in the future) so I’m glad to share the backstory. We started work on Duster during a team meetup in Arizona — notorious land of cowboys and shoot ‘em ups. We wanted something that reflected that same tough cowboy aesthetic and so, Duster. Well, actually, that’s only half true. It’s also the name of this really lovely pink flower you can find in Arizona. It’s really quite beautiful. :)

A Sample WordPress Theme Options Page

Update: This post is crazy old and there are way better options for … options panels now. Like the customizer! Otto can tell you how to leverage the customizer for your theme options. Or, heck, just go ahead and check out the sample code we use all the time.


Problem: You want to create a simple theme options page for your new WordPress theme but all the tutorials and sample theme options pages you’ve seen are way too complex or don’t fit in at all with the existing WordPress look.

Solution: We’ve come up with a simple, sample theme options page you can use for your next theme!

We’ve based this theme options page on the awesome sample plugin options page created by Ozh of Planet Ozh—only now with the bonus Radio and Select options and a Text Area.

Everything is bundled up in a Twenty Ten child theme called A Theme Options Theme—an instant working example—that you can download at the end of this post but here’s how you’d want to use it in your own themes …

Continue reading

Using TextMate for WordPress Code Cleanup

I spend a lot of time cleaning up WordPress themes. During the code cleanup I often perform certain cleanup tasks over and over, which makes them perfect for TextMate commands.

In this post I’ll show you how to add two useful commands to TextMate, then move through the steps I take for theme code cleanup and put the commands into practice.

First, let’s add the commands to a TextMate bundle. If you don’t know how to add commands to a TextMate bundle, or don’t have your own bundle set up yet, start here and add a new bundle. I usually add my own commands to a bundle called @lance so it sticks to the top of my bundle list.

Continue reading

Quick and Dirty Widget Testing

Testing widgets with your WordPress theme would be so much faster if you could enable all widgets at once, instead of dragging them one by one.

Here are two small functions to help with widget testing. The first takes all “Inactive Widgets” and adds them to the first registered sidebar in the theme. The second removes all widgets, leaving the widget area empty.

To use, add the code into your theme’s functions.php and uncomment the add_action() calls to trigger the functions. Happy testing!

<?php

/**
 * Quick and dirty inactive widget loading
 * Loads all inactive widgets into first registered sidebar
 *  
 * @global array $wp_registered_sidebars
 */

// To use: uncomment the add_filter call below, then refresh your admin Widgets page
// add_action( 'in_widget_form', 'enable_inactive_widgets' );

function enable_inactive_widgets() {

	// get first registered sidebar
	global $wp_registered_sidebars;
	$first_sidebar_id = array_shift( array_keys( $wp_registered_sidebars ) );

	// get widgets
	$widgets = get_option( 'sidebars_widgets' );

	// if inactive widgets exist, add them to the first sidebar
	if ( isset( $widgets['wp_inactive_widgets'] ) && '' != $widgets['wp_inactive_widgets'] ) {
		$inactive_widgets = array(
			$first_sidebar_id => $widgets['wp_inactive_widgets']
		);
		update_option( 'sidebars_widgets', $inactive_widgets );
	}
}

/**
 * Quick and dirty widget removal
 * This will remove both active and inactive widgets
 *  
 */

// To use: uncomment the add_action call below, then refresh your admin Widgets page
// add_action( 'in_widget_form', 'remove_all_widgets' );

function remove_all_widgets() {
	update_option( 'sidebars_widgets', null );
}

?>

An Idea for a New Default Theme for WordPress—Introducing Kirby

In 2010 WordPress will get a new Default Theme, replacing the beloved/hated Kubrick Theme with a new Theme called 2010. I’ve got opinions on the matter. Oh, do I have opinions. I’ve even gone so far as to create a working idea for a new Default WordPress Theme. Read on to find out more.

Principles for a WordPress Default Theme

I’ve set myself some principles for designing a Default Theme.

  1. It should look like a really nice blog theme with a “WordPress” feel
  2. It should be easy to modify and tweak by directly editing template files
  3. It should be easy to Child Theme without directly editing template files

These 3 principles sound pretty simple, right? Well, not really. If you’re just talking about them, yeah maybe. But talking about a WordPress Theme doesn’t make one. Are they so simple when you actually try and make a WordPress Theme that follows these principles?

No. Not really.

First of all, it’s relatively easy to design a WordPress Theme knowing it will only be used by people who have a specific purpose for it. You only download a WordPress Theme if you want to use it, right? Well, how do you design a WordPress Theme that will be forced on people? Most especially, forced on people who are new to WordPress? People who may take one look at the Default Theme and slap their monitors in horror lest they look on something so hideous, so, so limiting ever again?

Plus, who says a Default Theme should look like a “blog” Theme?

And, while knowing that most people start their WordPress-theming with the Default Theme and, increasingly, their web designing with the Default Theme—knowing and suffering under that awful pressure and responsibility—how do you make it easy to tweak simply and make it easy to Child Theme—without turning it into a Framework Theme.

Trust me here. While people may be asking for a Framework as the Default Theme they’re not all asking for the same thing. Something as robust as Thematic will have people running screaming away from it. People that want Framework Themes can download Framework Themes. I’m not so sure every new user should have one forced on them.

Continue reading