Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to create a child theme based on the twentyeleven theme. I understand how to create my own styles.css file to work for my child theme.

I would also like to create my own custom

header.php
index.php
footer.php
functions.php

files. My question is what information do I need to have placed in the header of each file.

Currently the copied index.php file has:

/**
 * The main template file.
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 */

Since this is my index.php file for my child theme what do I need to change?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

style.css is the one and only required file in a child theme. It provides the information header by which WordPress recognizes the child theme, and it replaces the style.css of the parent.

As with any WordPress theme, the information header must be at the top of the file, the only difference being that in a child theme the Template: line is required, so that WordPress knows which theme is the parent of the child theme.

Here is an example information header of a child theme’s style.css:

/*
Theme Name:     Twenty Eleven Child
Theme URI:      http: //example.com/
Description:    Child theme for the Twenty Eleven theme 
Author:         Your name here
Author URI:     http: //example.com/about/
Template:       twentyeleven
Version:        0.1.0
*/

A quick explanation of each line:

  • Theme Name. (required) Child theme name.
  • Theme URI. (optional) Child theme webpage.
  • Description. (optional) What this theme is. E.g.: My first child theme. Hurrah!
  • Author URI. (optional) Author webpage.
  • Author. (optional) Author name.
  • Template. (required) directory name of parent theme, case-sensitive.
  • NOTE. You have to switch to a different theme and back to the child theme when you modify this line.
  • Version. (optional) Child theme version. E.g.: 0.1, 1.0, etc.

The part after the closing */ of the header works as a regular stylesheet file. It is where you put the styling rules you want WordPress to apply.

more details: http://codex.wordpress.org/Child_Themes

share|improve this answer
    
Thank you. I just wanted to get verification. I didn't see anything saying that you didn't need to include header info for child theme files. –  TikaL13 Feb 7 '12 at 17:18
    
Template files are optional if you include it will be use otherwise it will use from parent theme –  Shaon Feb 7 '12 at 19:16
add comment

You don't have to have a specific header for any child php file. It just has to be within your child theme folder. Only your child's style.css requires a specific header.

http://codex.wordpress.org/Child_Themes

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.