July 14, 2012
Instructor: Joe Querin (@joequerin)
Slides: http://www.slideshare.net/joecue/theme-development-essentials-columbus-oh-word-camp-2012
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
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
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).
*/
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
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.
- 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!
- 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
- 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