Setting Up A WordPress Child Theme Without A Plugin

Website Design Wireframe

A WordPress child theme is a theme that inherits the functionality and styling of another theme, known as the parent theme. Child themes are a useful tool for making customizations to your WordPress site, as they allow you to modify the parent theme without affecting the original code. In this article, we’ll show you how to set up a child theme for WordPress.

To create a child theme, you’ll need to have a parent theme installed on your WordPress site. If you don’t have a parent theme installed, you can download and install one from the WordPress theme repository. Once you have a parent theme installed, you can create a child theme by following these steps:

  1. Create a new folder in your WordPress theme directory, and name it after your child theme. For example, if your child theme is called “MyChildTheme”, the folder should be named “mychildtheme”.

 

2. Create a new file in your child theme folder, and name it “style.css”. This file will contain the styles for your child theme.

 

3. Open the “style.css” file in a text editor, and add the following code at the top of the file:

				
					/*

Theme Name: My Child Theme

Theme URI: http://example.com/my-child-theme

Description: A child theme of the Twenty Twenty theme

Author: Your Name

Author URI: http://example.com

Template: twentytwenty

Version: 1.0.0

*/
				
			

4. Replace the placeholders (e.g. “My Child Theme”, “example.com”, etc.) with your own information. The “Template” value should be the same as the folder name of the parent theme you are using (e.g. “twentytwenty” for the default WordPress theme).

 

5. Save the “style.css” file and go back to the folder on your computer.

 

6. Inside the folder, create a new file and name it “functions.php”. This file will contain any custom functions you want to add to your child theme.

 

7. Open the “functions.php” file in a text editor and add the following code at the top:

				
					<?php

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

				
			

8. Save the “functions.php” file and go back to the folder on your computer.

 

9. Now, you need to upload the child theme to your WordPress site. You can do this by connecting to your site using an FTP client (e.g. FileZilla) and uploading the folder to the “wp-content/themes” directory on your server.

 

10. Once the folder is uploaded, log in to your WordPress admin dashboard and go to “Appearance” > “Themes”. You should see your child theme listed there.

 

11. Click on the “Activate” button next to your child theme to make it the active theme on your site.

 

12. Your child theme is now set up and ready to use. You can start making customizations by adding your own styles to the “style.css” file and custom functions to the “functions.php” file.

 

Setting up a child theme in WordPress is a simple process that can save you a lot of time and effort when making customizations to your site. It allows you to update the parent theme without losing your customizations and ensures that your site stays compatible with the latest versions of WordPress.