If working with a WordPress theme that does not look or act the way one wants, it may be prudent to create a “child” theme. That way, if at any point the original theme developer releases a new version of the theme that includes bug fixes and / or new functionality, one can update the parent theme without overwriting customizations contained in the child theme.
Creating a child theme is not inherently hard. What can be a challenge is understanding how the parent theme is built so one is editing the proper files.
If ready to dive in and create a child theme, follow these steps:
- Create a directory wp-content/themes to contain your theme
- Create style.css file. Add information about the theme you are creating at the top of the file.
/* Theme Name: INSERT NAME OF YOUR THEME
URI: INSERT LINK TO YOUR THEME ON THE WEB
Author: INSERT YOUR or YOUR COMPANY'S NAME
Author URI: INSERT LINK TO YOUR ONLINE PORTFOLIO or WEBSITE
Description: INSERT A BRIEF DESCRIPTION ABOUT THE THEME
Version: INSERT VERSION NUMBER
Template: INSERT NAME OF PARENT THEME */
- Create functions.php file and add the following code at the top of the file
<?php // enqueue styles for child theme function example_enqueue_styles() { // enqueue parent styles wp_enqueue_style('parent-theme', get_template_directory_uri() .'/style.css'); // enqueue child styles wp_enqueue_style('child-theme', get_stylesheet_directory_uri() .'/style.css', array('parent-theme')); } add_action('wp_enqueue_scripts', 'example_enqueue_styles'); ?>
- Create theme thumbnail (sized 1200 x 900 and named screenshot.png) and place in child theme folder (Optional step)
- Activate the new theme by going to “Appearance >Themes” in the WordPress admin interface.
Additional Resources