How to install Child-Theme easily, step by step for newbies »Compa Marketing

If you love your current theme but want to modify its features and interface, the appropriate way to do that is by customizing its sub-theme. This tutorial will explain why this practice is necessary and guide you through the process so that you can create and edit WordPress sub topics regardless of your technical skills.

Why should you use Child-theme WordPress?

Because a subtopic inherits the characteristics of the main topic or the original topic, you can customize its code without breaking the original function of the original. This way, if a theme is updated, all changes you have made will be overwritten.

Another reason to use a subtopic is that it provides an unsafe solution if you ruin your edits. In addition, it allows you to effectively track the sections you have changed since the files of a sub topic are separate from its parents.

How WordPress Theme Themes works

As mentioned briefly earlier, a sub-topic is stored in a separate folder from the original topic, each topic has style.css and.php files. You can add other files as needed, but those two are the minimum needed for a subtopic to work correctly.

Using the related .css and .php files, you can modify everything, from styles, layout parameters to actual coding and the script used by a sub-topic even if the properties Aren properties appear in its main thread.

Think of it as a coating. When visitors load your site, WordPress will first download the sub theme and then fill in the missing styles and functions using sections from the main theme. As a result, you make the best use of your custom design without sacrificing the core functionality of the theme.

Create a Child-Theme in WordPress

The following instructions use Twenty Seventeen basis. You can use a different theme if you like. We will also use the Hostinger File Manager from to add and edit files, although FTP also works.

Now, without further advertising, here's how to create sub-themes in WordPress:

Now, without further advertising, here's how to create sub-themes in WordPress:

  • Access CPanel file and click File Manager.
  • Navigate to public_html -> wp-content -> topic directory.
  • Create a new Folder by clicking its icon in the menu above. Enter your sub subject name Name and click Create. It recommends using parent topic name Names with a suffix -child. In this example, we named the directory as twentyseventeen-child .
  • In the directory, create the style.css file. Fill its content with the following code:

/*
Theme Name: Twenty Seventeen Child
Theme URL: http://yourdomain.com
Description: Twenty Seventeen Child
Theme Author: Your Name
Author URL: http://yourdomain.com
Template: twentyseventeen
Version: 1.0.0
Text Domain: twentyseventeen-child
*/

  • Change all values ​​accordingly. The most important field is Template because it tells WordPress the root theme your child theme is based on. Once done, click Save and Close.
  • Create another file named functions.php in the same directory, but do not enter that code from the parent topic file because it needs to be separated. Instead, copy and paste the code below into a blank file and save it:

add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );

function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}

About My name is Nguyen Manh Cuong. I was born in a poor village in Ba Vi district, HA NOI province - windy and sunny land. Currently. https://www.nguyendiep.com/. Mr Cuong.
Newer Posts Newer Posts Older Posts Older Posts

Comments

Post a Comment