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
2 Answers
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
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.