1

I have a child theme that will load my style.css file but will not load my php template file.

I got this template file by copying and pasting it from the parent directory into a new file with the same file name and everything. Then I edited one line of text as a test and loaded the file into the root of the child theme directory. I refreshed my site but no change could be seen.

The theme is zerif-lite and I'm not sure why this is happening

  • Hello @pine_cone - Welcome to the WordPress Development community! Please review How to Ask in our help center to learn what goes into a good question. You might want to brush up on the Template Hierarchy and the entry on Child Themes to grasp how WordPress selects template files, then edit your question include more information. Any errors WordPress is issuing would also be helpful. – bosco Dec 8 '15 at 2:44
  • I am assuming you have actually activated the child theme in Themes? Use the What The File plugin to tell you which template file is being used for the page you're checking. – garth Dec 8 '15 at 4:30
  • what template file exactly? what is the file name, and what is the location of that file in the parent theme? – Michael Dec 8 '15 at 4:36
0

This is a basic WordPress question, please get familiar with theme theming concepts.

Basic theme: https://codex.wordpress.org/Theme_Development Child themes: https://codex.wordpress.org/Child_Themes

Theme hierarchy

enter image description here

Parent theme style.css

/*
Theme Name: Twenty Fifteen
Theme URI: https://wordpress.org/themes/twentyfifteen/
Author: the WordPress team
Author URI: https://wordpress.org/
Description: Twenty Fifteen
Version: 1.3
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentyfifteen

This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/

Child theme style.css

/*
 Theme Name:   Twenty Fifteen Child
 Theme URI:    http://example.com/twenty-fifteen-child/
 Description:  Twenty Fifteen Child Theme
 Author:       John Doe
 Author URI:   http://example.com
 Template:     twentyfifteen
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twenty-fifteen-child
*/

Note: Template: twentyfifteen this section is very important. Template name should match with the parent template folder name.

This is a basic example of how child theme works in WordPress. You can find more information at templating documentation.

-2

Place a directory in the child directory with the name of the directory from the parent directory where the .php template file was originally found. Then place the modified template in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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