How to properly create a child theme

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?

Topic theme-twenty-eleven child-theme theme-development Wordpress

Category Web


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


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

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.