Couple of things to add
- If you add template files on child theme. They will replace the parent theme template files.
- CSS doesn’t get imported automatically so you have to import them on your child theme css file using
@import
, It might look something like this@import url("../twentyeleven/style.css");
functions.php
file doesn’t get replace so all functions from parent theme is still defined and you can add your new php functions on child themesfunctions.php
file.- If you copy and paste a php file from parent theme to child theme for modification and you see something like
require_once(TEMPLATEPATH.'/includes/a_php_file.php');
Remember thatTEMPLATEPATH
constant still points to parent theme directory. If you need to change the filea_php_file.php
then copy that file into your child theme too and use themes stylesheet path to get into child theme. So you have to do something like thisinclude( get_stylesheet_directory() . '/includes/a_php_file.php');
So How do I make Sure Child theme file is used:
Well, if you do everything right child theme templates already getting used. But still if you want to check you can just add a html comment on the template file and check the source. I do it sometimes when things doesn’t work for me also I add the php file name to the html comment so i know which file includes/requires from where.
Codex:
http://codex.wordpress.org/Function_Reference/get_stylesheet_directory