If you can't read please download the document
Upload
daisyolsen
View
3.149
Download
0
Embed Size (px)
Citation preview
Child Themes
Daisy Olsenhttp://daisyolsen.com
What is a Child Theme
Installed and activated like any other theme
Dependent on a parent theme for elements not found in the child theme
Only style.css is required
Can be used to re-skin a theme
Can add functionality
Can over-ride parts of the parent theme
Why Use a Child Theme
Future-proof your customizations
Rapid development
Build upon a consistent codebase
Understanding of PHP and WordPress themeing is helpful but not required for basic child themes
Child Theme Files
WordPress template hierarchy
style.css Only Child theme file is used.
functions.php Both parent and child files always run.
Other files Child theme checked first then Parent theme. First
file found runs.
Specific General
Making a Child Theme
Get to Know your Parent Theme
Create style.css
Page Templates
Overriding Parent Theme Files
Demo site: http://wpthemedemos.com
Required in style.css
/*Theme Name: Twenty Ten Child DemoDescription: A Child Theme for Twenty Ten for Demonstration.Theme URI: http://daisyolsen.comAuthor: Daisy OlsenAuthor URI: http://daisyolsen.comTemplate: twentytenVersion: 1.0*/
style.css
Option #1 import style.css from parent theme
@import url('../twentyten/style.css');
Option #2 Copy/Paste entire style.css from parent theme into child theme style.css
Option #3 Build new style.css from scratch
Hooks
Twenty Ten has one hook built in for adding additional content. WordPress also includes some hooks that can be used.
do_action( 'twentyten_credits' );Think of a hook as an insertion point.
add_action('twentyten_credits', 'my_credits');function my_credits() {echo 'This is my credit line using a function';}
Replace Theme Template Files
Our Demo Child theme replaces the footer.php file with a customized version which changes the default footer credits with customized ones.
If a template file exists in the child theme the parent theme file is ignored.
Template Parts
New to WordPress 3.0
Twenty Ten allows you to modify the loop by creating a new file in the child theme with a modified version of loop.php
We will modify the way the category archive displays with loop-category.php
Theme Frameworks
Built with the intention of being modified via child theme
Extensive Action/Filter Capabilities
Active Development
Popular Parent/Child FrameworksHybrid
Thematic
Genesis (Commercial) - StudioPress
Builder (Commercial) - iThemes
Resources
Codex: Child Themes
Aaron Jorbin's Guide
Understanding Child Themes
Modify WordPress Themes The Smart Way
Click to edit the title text format