Skip to content

Instantly share code, notes, and snippets.

@stevegrunwell
Created July 14, 2012 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevegrunwell/3112707 to your computer and use it in GitHub Desktop.
Save stevegrunwell/3112707 to your computer and use it in GitHub Desktop.
Theme Development Essentials - WordCamp Columbus 2012

Theme Development Essentials

July 14, 2012

Instructor: Joe Querin (@joequerin)

Slides: http://www.slideshare.net/joecue/theme-development-essentials-columbus-oh-word-camp-2012

What is a theme?

A collection of PHP scripts, CSS files, and images to create the look and feel

Can also include:

  • Custom post types
  • Theme options
  • Sidebars
  • Nav menus

Template files

Base files

  • style.css
  • header.php
  • index.php
  • loop.php
  • footer.php

Additional files

  • sidebar.php
  • page.php
  • category.php
  • tag.php
  • author.php
  • single.php
  • 404.php
  • ...

See http://codex.wordpress.org/Template_Hierarchy for more

style.css

Important to define theme name and description.

Example:

/*
  Theme Name: Twenty Ten
  Theme URI: http://wordpress.org/
  Description: The 2010 default theme for WordPress.
  Author: wordpressdotorg
  Author URI: http://wordpress.org/
  Version: 1.0
  Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu (optional)
  License:
  License URI:
  General comments (optional).
*/

Theme frameworks

Allows you to develop child themes that inherit look, feel, and functionality from the parent theme.

Popular theme frameworks

  • Thematic
  • Thesis
  • Genesis
  • Gantry
  • Hybrid
  • HEADWAY
  • Whiteboard

Child themes in the WordPress codex

Making a theme responsible

Child themes should allow the user to customize the look of the site without impacting underlying functionality. This means that the parent theme can be updated and pass on its updates to child themes.

Why create a custom theme?

  • Functionality is required that cannot be accomplished through plugins
  • Unable to find a theme that can either be modified or have a child theme created for it
  • Because you want to!

Where to start

  • WordPress Codex
  • Look at a sample theme (TwentyTen, TwentyEleven)
  • Download a theme from the wordpress.org repository

What not to do

Download a theme from a "free wordpress theme" web search

Questions to ask when you get started

  • Are you going to create a framework/use a framework to start?
  • Will the theme be a child theme based on someone else's theme?
  • How will the site function?
    • Mostly posts, pages, or a mix?
  • Create a design for your theme
  • Decide how to divide your theme so you can crete the necessary files

Tips

  • Go to the codex
  • Enable WPDEBUG in wp-config.php to catch deprecated code
  • Try to break your theme
  • Theme Check Plugin
  • If you try to change the WordPress core files, you're gonna have a bad time
  • Consider putting Google Analytics directly into your theme, which cuts down on your plugin overhead
  • Evaluate current plugins and see what you can get away with not using
  • If you're missing the admin bar, make sure you have <?php wp_footer(); ?>
  • Setup a good development environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment