WordCamp KC 2012: Simplifying Theme Functionality

Embed Size (px)

Citation preview

Simplifying Theme Functionality

@chip_bennett

Chip Bennett, WordCamp Kansas City, 02 June 2012

Simplifying Theme Functionality

Audience:Developers

New and Derivative Themes

Why Simplify?

De-crappifying header.php

Streamlining functions.php

Reducing Theme Options

General Clean-Up of Theme Files

Unneeded Functions/Callbacks (Twenty Ten/Twenty Eleven Derivatives)

WordCamp Kansas City: 02 June 2012

Why Simplify?

Make everything as simple as possible, but not simpler.- Albert Einstein

WordCamp Kansas City: 02 June 2012

Simplifying Theme Functionality

Theme Maintenance & SupportSimplifying Theme functionality will facilitate maintenance, support, and bug-fixing

WordCamp Kansas City: 02 June 2012

Why Simplify?

Simplifying Theme Functionality

Theme Maintenance & SupportSimplifying Theme functionality will facilitate maintenance, support, and bug-fixing

Plugin Support/IntegrationSimplifying Theme functionality will facilitate out-of-the-box support for more Plugins

WordCamp Kansas City: 02 June 2012

Why Simplify?

Simplifying Theme Functionality

Theme Maintenance & SupportSimplifying Theme functionality will facilitate maintenance, support, and bug-fixing

Plugin Support/IntegrationSimplifying Theme functionality will facilitate out-of-the-box support for more Plugins

Child ThemesSimplifying Theme functionality will facilitate Theme modification and extension via Child Theme

WordCamp Kansas City: 02 June 2012

Why Simplify?

De-Crappifying header.php

...because what's there doesn't really need to be there

WordCamp Kansas City: 02 June 2012

Simplifying Theme Functionality

WordCamp Kansas City: 02 June 2012

De-Crappifying header.php

Your SEO Plugin is crying.

Simplifying Theme Functionality

WordCamp Kansas City: 02 June 2012

De-Crappifying header.php

Your SEO Plugin is crying.

The wp_title filter is your friend.

Simplifying Theme Functionality

WordCamp Kansas City: 02 June 2012

De-Crappifying header.php

function themename_filter_wp_title( $title ) { $new_title = ''; if (is_home()) { $new_title = esc_attr( get_bloginfo( 'name' ) ); } elseif (is_404()) { $new_title = '404 Not Found' . ' | ' . esc_attr( get_bloginfo( 'name' ) ); } elseif (is_category()) { // etc... } return $new_title;}add_filter( 'wp_title', 'themename_filter_wp_title' );

functions.php

header.php

Simplifying Theme Functionality

RSS Feed Links

WordCamp Kansas City: 02 June 2012

De-Crappifying header.php