9. The code needed
/*
Theme Name: You Company Theme.
Theme URI: http://bearne.ca
Author: Paul Bearne
Template: twentyeleven
Author URI: http://bearne.ca/
Description: This is the special theme I created just for your company’s
website.
Version: 1.0
License: GNU General Public License
License URI: license.txt
Tags: dark, light, white, black, gray, one-column, two-columns, left-sidebar,
right-sidebar, fixed-width, flexible-width, custom-background, custom-colors,
custom-header, custom-menu, editor-style, featured-image-header, featured-
images, full-width-template, microformats, post-formats, rtl-language-support,
sticky-post, theme-options, translation-ready
*/
@import url('../twentyeleven/style.css');
10. How to install it
Save as style.css
In a new folder called "theme-name" ... for example:
" YourCompanyTheme"
Create a zip of the folder - newTheme.zip (this zip
needs a subfolder with the style.css in it )
Upload it
11. Or FTP it
Upload it to the Themes folder in a new folder
which follows to show the theme folder as:
YourCompanyTheme
15. Replacing template files
Copy just the files from parent theme that you
need to change to you daughter folder and edit
them.
WordPress looks in the daughter folder first and
loads the file if found
16. functions.php
WordPress will load BOTH function.php files
child function.php then the parent function.php
So you only need to add the extra/replacement
functions
Example:
<?php
add_action( 'after_setup_theme', 'CompanyNameTheme_setup' );
if ( ! function_exists( 'CompanyNameTheme_setup' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*/
function CompanyNameTheme_setup() {
// The default header text color
define( 'HEADER_TEXTCOLOR', 'fff' );
// By leaving empty, we allow for random image rotation.
define( 'HEADER_IMAGE', '' );
}
endif; // CompanyNameTheme setup
17. Page Templates
Custom layout for pages
Good for Coming soon
Landing pages
Galleries etc.
<?php
/*
Template Name: Homepage
*/
?>
18. Template Hierarchy
If your blog is at http://example.com/blog/ and a visitor clicks on a
link to a category page like
http://example.com/blog/category/your-cat/
WordPress looks for a template file in the current Theme's
directory that matches the category's ID.
If the category's ID is 4, WordPress looks for a template file
named category-4.php.
If it is missing, WordPress next looks for a generic category
template file, category.php.
If this file does not exist either, WordPress looks for a generic
archive template, archive.php.
If it is missing as well, WordPress falls back on the main Theme
template file, index.php.
http://codex.wordpress.org/Template_Hierarchy
19.
20. Notes
You can’t have a child of a child (1 layer only)
There is a very small performance hit