Skip to main content

Child Theme

Child Theme

Wordpress child theme allows you change the functionality of the theme without having to edit the original/parent theme template files. If you need to modify any template file, we recommend to create a child theme instead of editing the theme template files. Since the child theme is stored separately, you don't need to redo the changes next time you upgrade the theme. Coding child themes requires some basic computer skills (ie. creating PHP files, uploading files, and modifying code).

How Child Theme Works
Basically once the child theme is activated, WordPress will look for the template files in the child theme folder first. If the file doesn't exist in the child theme, it will fallback to the parent theme folder. In other words, if there is a "header.php" in the child theme, WordPress will use that "header.php", else it will use the "header.php" file in the parent theme.

Creating a Child Theme :
Step 1: Create a new child theme folder
To start a child theme: on your computer desktop, create a new folder (eg. "themify-ultra-child")
Step 2: Create the child theme style.css
In the child theme folder, create a new CSS file in the child theme folder and name it style.css.
Paste the sample code below in the style.css file and change the theme name and template name as instructed below.
/*
Theme Name: Themify Ultra Child
Description: Child theme for Themify Ultra
Author: Themify
Template: themify-ultra
*/

/* write custom css below */
Theme Name (required) = use the parent theme name + child to make it easy to identify (eg. "Themify Ultra Child")
Description  (optional)= you may enter any text here
Author  (optional) = your name
Template  (required) = name of the parent theme folder (in this case, it is "themify-ultra")
Then you may add any additional custom CSS as you want in the child theme style.css (optional).

Final Step) Installing/activating The child theme
Once you have the child theme done, zip it (eg. it should be compressed as "themify-ultra-child.zip")
Login to your WP Admin, then go to Appearance > Theme, install the child theme zip (the same way as installing a WordPress theme), and then activate it.
NOTE: Make sure the parent theme is installed (ie. if the parent theme is "Themify Ultra", make sure it is installed in your WordPress site).

Advanced/Optional: Overriding Parent Theme Template Files
Overriding template files is intended for developers who have PHP and WordPress coding knowledge. It is only required if you need to override the parent theme template files. If you are not sure how to do this, consult a developer.
To override the template files in the parent theme, open the original template file and save a copy to the child theme folder with same file name and folder structure. Basically, the file structure has to match with the parent theme.

For example:
let's say you want to edit the loop.php file in the parent theme and it is stored in the "includes" folder
open the loop.php file and save a copy in the "includes" folder of the child theme

edit and save the loop.php in the child theme.

Comments

Popular posts from this blog

As a symfony developer what you should take care when symfony standard edition is legacy:

Now  symfony standard edition is legacy . So no need to worry much just go threw article and understand whats new in symfony 4 if standard edition is legacy now. This is the main difference in Symfony 4 from symfony 2 and symfony 3 . Older symfony versions provide by default doctrine, twig, form, validation, profiler, annotations and many other components. But some time user do not want to use it. Suppose what if user do not want to doctrine or twig? Still he has doctrine and twig in his dependency. That makes symfony heavy framework. When starting a new project developers do not like to assemble things manually. So symfony 2 and 3 provides standard edition for developers to start a big project. But was hard to scale down project and decrease dependency if user do not require some packages. Symfony 2 and 3  are big success and in years developers are now aware with composer and dependency injection. So adding/removing a new package is not a big deal. So symfony chose...

Learn Angular 4 from scratch

Angular 4 is the latest version of AngularJs released in March 2017. The basic steps to accomplish our first Angular 4 hello world example. Here, we’ll simply create a component that passes the title from component to the view. 1. Install Angular CLI The Angular CLI is a command line interface that helps to scaffold and build angular apps in Node.js style. Also, it set up the angular 4 environments and will be helpful for us to work with angular apps like creating, running, etc. Now, install Angular-CLI. <code>npm install -g angular-cli</code> Once installation is done, just make sure that it’s installed by checking it’s version. <code>ng -v</code> 2. Install an Angular 4 Hello World App Here, we will create an app named hello-world ng new hello-world Now, go to the directory of a newly created project. cd hello-world Before running your app, let’s dive a bit deeper in coding behind the picture. 2.1 Fi...

3 Node.js Alternatives To WordPress

3 Node.js Alternatives To WordPress As compare to WordPress there is alternative option like Node.js. There are many various latest challengers that have large communities, support themes, plugins and are easy to install on your own server. Here are 3 you might want to checkout. KeystoneJS KeystoneJS is a content management system and framework to build server applications that interact with a database. It is based on the Express framework for Node.js and uses MongoDB for data storage. It represents a CMS alternative for web developers who want to build a data-driven website but don’t want to get into the PHP platform or large systems like WordPress. EnduroJS Enduro.js offers a fast and easy way to build your project, beautiful and simple admin UI and integrated tools to build everything on the server. It works without a database, instead relying on a system of flat files that can be opened directly in a text editor. It is easy to install and can be deployed via Git. ...