How to develop a Child theme in wordpress

Why need to develop the wordpress child theme?

There are many reasons to develop child theme. There can always a problem with the custom theme or customized theme if we update theme, plugins and wordpress. After updating any of them we loose out custom developed design and functionality. Because we change in the theme files most of the things we done withing the functions.php and style.css or any other files of theme. So when we update a theme, it over write the theme files. so our custom code in the any of the file flushed by update and the custom developed functionality and the custom made design html,css and jquery also flushed by the updates. So the best way to secure our custom made scripts we need to develop the child theme extending out current theme. So when the current theme will update the extended child theme will not over write.

Developing a child theme

We can easily develop the child theme it is very easy to develop. It will take little amount of efforts and your custom design and functionality will be secure forever.  Let start with the any exists theme. I am using the theme name 'mytheme' to extend and the child theme name is 'mychildtheme'. follow the instructions below to develop a child theme:-

1. First create a directory of child theme like 'mychildthme' in the "/wp_content/themes/"

2. Create a style same as we develop for any theme and write about the theme details in comments in top of file
   
/*
Theme Name: My Child Theme
Theme URI: http://nxtut.com/
Author: Daljeet Singh
Author URI: http://nxtut.com/
Description: This is my first child theme
Version: 1.1
*/


3. Import the style of the theme from we and extending it. Use the below code in the style sheet after the theme details section. I am importing the style of 'mytheme' into the 'mychildtheme'

@import url("../mytheme/style.css");

4. Place a screenshot.png of out new theme in the 'mychildtheme'

5. Copy the necessary templates files from your 'mytheme' to 'mychildtheme' like header.php, footer.php, page.php etc. whom you want to overwrite

6. functions.php required the required methods of extended theme to in the 'mychildthme'

7. After that you can see the child theme in the theme section under appearance menu in the admin area.

8. After activating the child theme when you see the fronted it show the same design is workin gfrom we extended the design.

9. If getting any time of php warning of error on page jut need to copy some methods or files in child theme from the parent theme. It happen just because of every parent theme have different specific methods for some special functionality like any widgets, hooks, sidebars,menus, module etc.






Students Tech Life