How to create a child theme in WordPress without plugin

Why do you need a child theme in WordPress?

If you want to manually modify your website design using CSS, add more functionality using PHP, add effects using javascript you need to create and use a child theme. 

Why?- because every time developers update the original parent theme the files are overwritten and all your customizations will be gone. 

How to create a child theme in WordPress without plugin

YouTube video

There are several ways to create a child theme, but in this guide I will show you how to do that without using any plugins. 

You need a parent theme– this is the original theme, which is already on your website,- all design and functionality is pulled out as a base. In other words TwentyTwentyThree, GeneratePress, Astra, Kadence or any other your favorite theme must be installed on your blog already.

Create a folder

Create a folder on your computer and name it as you wish. It makes sense to name it as your parent theme and add child theme at the end e.g. generatepress-child

Create a file named style.css

Onside the folder create a file style.css and add this code.

Note: I suggest editing theme files using Notepad++, Sublime Text, Visual Studio Code editor or any other. It’s much easier and eye appealing to see code lines with colors.

/*
 Theme Name:   Awesometheme Child
 Theme URI:    https://mywebsite.com
 Description:  Default mywebsite child theme
 Author:       John Smith
 Author URI:   https://mywebsite.com
 Template:     generatepress
 Version:      0.1
*/

You can modify text after colon (:) and add all your details except on the Template line. Instead of generatepress you have to write your parent theme name. e.g.: twentyfifteen, twentytwentyone, Divi or whatever you are using. Save and close the file. 

Create a file and name it functions.php

Add this code below to it

<?php
/**
 * mywebsite child theme functions and definitions.
 *
 * Add your custom PHP in this file.
 * Only edit this file if you have direct access to it on your server (to fix errors if they happen).
 */

Save file and close it.

Create a file screenshot.png

This image will be shown as your theme cover image in your WordPress dashboard. 

child theme screenshot file image

Compress folder in zip format

Now you need to archive that folder in zip format. You can do that by using WinRAR (forever free trial) or natively if you’re using Windows 11. (There are many software options to compress files). 

Upload and activate the child theme

Login to your WordPress dashboard, go to Appearance -> Themes and upload your zip file. 

Activate the theme and you’re done. Congratulations 🙂 You can now start to modify your website like a PRO!

Source: WordPress.org

P.S. As you may already know I’m using the GeneratePress WordPress theme on my website so here is a bonus video on how to create a child theme for Generatepress. 

YouTube video

You may also like:

About Mantas J

Blogger, marketer, coffee lover,- currently now developing several online projects. I know a thing or two about digital marketing :) Follow me on Twitter or YouTube.