I am creating a child theme , but my child theme in WordPress not including template files of Parent theme. I have read that all the files which are not included in Child theme are automatically imported Child theme But after activating child theme The website is displaying only header, footer and menus but not any page templates and content. Am I forgetting any step or Do I have to add some code or additional files. I am new to Wordpress.
1
votes
What templates/files are in your child theme
– Pieter Goosen
I have only included only style.css files till now
– Shivek Parmar
Read this carefully, I hope this is help you codex.wordpress.org/Child_Themes
– Sp.
I did but not resolving my issues?? Is creating a Child theme is THEME specific.??
– Shivek Parmar
I have resolved it but only half part. When I am selecting any other than home page then the content of that page is displaying but when I select my home page as a static page then it is not displaying the content of that page? Do u have any suggestions what is wrong here?
– Shivek Parmar
1 Answers
4
votes
For creating a child theme, make a folder inside your 'themes' folder with you child theme name. Now the child theme should have a style sheet in it which is a must. So add a style sheet and the beginning of the child theme style sheet should be as follows:
/*
Theme Name: (theme name) Child
Theme URI: (give URL)
Description: (give description)
Version: (give your version)
Author: (author name)
Author URI: (give URL)
Template: (name of parent theme)
*/
Of these the very important thing is the 'Template' which is the parent theme name. To avoid confusion take the name of parent theme from the parent theme style sheet.
Now the second thing is the functions of your child theme. Just add a php file with the name functions.php and place the below code
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>
This code is for enqueuing the parent theme styles. Here you go! your child theme will work now. It worked for me.