Quickly Create a WordPress Child Theme
WordPress is a free software package to make it easy for people to manage their own websites. It allows for easy blogging and content management and can be regarded as a full blown Content Management System (CMS). Most web hosting companies provide simple WordPress installation for domains and web hosting purchased through them. Plus there is the dedicated WordPress site for blogging at WordPress.com.
The look of a site using WordPress is controlled by the current theme it is configured to use. By switching to a new theme a new look for a website can be achieved without altering the site content.
WordPress comes with several default themes, named after the release year. There are default themes named Twenty Thirteen, Twenty Fourteen and Twenty Fifteen. Earlier ones can be added for free. There are thousands of paid for commercial "premium" themes and free community or open source themes.
Child Theme Quick Start with a New Folder and Files
A theme can be changed to fine tune it to your own requirements. The best way to do this is to create a child theme that references the theme you want to change. Make any required changes in this child theme and keep the original theme untouched. This prevents customisations from being lost when WordPress or original themes are updated. This article covers the basics of getting a child theme ready, which simply involves creating a new folder in the WordPress installation and adding two new files. A file called style.css, a Cascading Style Sheet (CSS) file, and a file called functions.php, a code file.
Once the child theme is generated select it from the Themes option under Appearance when logged into WordPress. When the original theme is updated when a new release comes out, the changes made to the child theme are not overwritten.
Create a Blank Child Theme to Allow For Theme Modification
Each theme is in its own folder in the WordPress installation. WordPress will be installed in the website's root folder, or a folder off the root. Most web hosting providers provide a control panel with a file manager to view the website folders and files. There will be a wp-content folder and inside that a themes folder. In the themes folder there is a folder for each installed theme. Thus there is a wp-content/themes/twentythirteen folder for the Twenty Thirteen theme, a wp-content/themes/twentyfourteen folder for the Twenty Fourteen theme and so on.
Quickly Create a WordPress Child Theme Starting Point
Make a WordPress child theme by adding new files to a new folder in themes and editing the new files. The new files will reference the original theme. Most hosting companies provide on line tools to allow files and folders to be changed on your website.
(Alternatively create the new folder and files off line and use FTP to upload the folder and files to the themes folder. Hosting company's usually provide on line FTP tools, or use a program such as FileZilla. Your hosting company will provide you with the FTP log in details if needed.)
Create a new folder in themes and give it a name (e.g. myowntheme). In the new folder create a file called style.css. Add the following text to the file, changing the values for Theme Name and URI, Author Name and URI and the description as required:
/*
Theme Name: My Own Theme
Theme URI: http://your-themes-homepage.com
Description: Child theme for the Twenty Sixteen theme
Author: Your Name
Author URI: http://www.your-website.com
Template: twentysixteen
Version: 0.1.0
Descriptive Text
*/
/* Ready for custom styles. */
That's the starting point done. Here the theme is based on the default Twenty Sixteen theme. You will enter the name of your chosen theme for the basis of the child theme. Next create the functions.php file in the myowntheme folder (or whatever folder was created). Add this code (note the function can have a custom name but must match the second name parameter in the add_action call):
<?php
function mytheme_enqueue() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'mytheme_enqueue' );
The theme will now show up on the Themes page under Appearance in the admin screens. Modifications to the theme will be made by adding files and code to the new theme.
Any files that appear in the child themes folder can be changed in the WordPress Editor.
See Also
Author:Daniel S. Fowler Published: Updated: