Quantcast
Channel: Martech Zone
Viewing all articles
Browse latest Browse all 1488

If You Don’t Know What a WordPress Child Theme is…

$
0
0

wordpress child theme

You’re modifying WordPress themes incorrectly.

We’ve worked with dozens of clients and built out hundreds of WordPress sites over the years. It’s not that our job is to create WordPress sites, but we wind up doing it for many clients. Clients don’t come to use WordPress sites very often. They typically come to us to help optimize their sites for search, social, and conversions.

More often than not, we get access to the site to optimize templates or build out new landing page templates, and we discover something awful. We often find a well-designed, well-supported theme that was purchased as a foundation of the site and then highly modified by the client’s previous agency.

Editing a core theme is a terrible practice and needs to stop. WordPress developed Child Themes so that agencies could customize a theme without touching the core code. According to WordPress:

A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. Child themes are the recommended way of modifying an existing theme.

As themes become more and more involved, the theme is often sold and often updated to take care of bugs or security holes. Some theme designers even continue to enhance features in their theme over time or support the theme through WordPress version updates. We purchase the vast majority of our themes from Themeforest. You’ll find that top themes on Themeforest are sold tens of thousands of times and have full design agencies continuing to support them.

When we work with a client, we have them review the themes to see the features and functionality they like. We ensure the theme is responsive on mobile devices and has great flexibility for layouts and shortcodes for customization. We then license and download the theme. Many of these themes come pre-packaged with a Child Theme. Installing both the Child Theme and Parent Theme, and then activating the Child Theme allows you to work within the Child Theme.

Customizing a Child Theme

Child Themes are typically prepackaged with the parent theme and named after the theme with Child on it. If my theme is Avada, the Child Theme is typically named Avada Child and is contained in the avada-child folder. That’s not the best naming convention, so we rename the theme in the style.css file, rename the folder after the client, and then include a screenshot of the final, customized site. We also customize the style sheet details so that the client can identify who built it in the future.

If a Child Theme isn’t included, you can still create one. An example of this is a Child Theme we developed for our agency. We named the theme DK New Media 2018 after our site and the year it was implemented and placed the Child Theme in a folder one-eight. The CSS stylesheet was updated with our information:

/*
Theme Name: DK New Media 2018
Description: Child theme for DK New Media based on the Avada theme
Author: DK New Media
Author URI: https://dknewmedia.com
Template: Avada
Version: 1.0.0
Text Domain: Avada
*/

Within the Child Theme, you’ll see the parent theme dependency identified as the Template.

Outside of some CSS edits, the first template file we wanted to modify was the footer. To do this, we copied the footer.php file from the parent theme and then copied it into the one-eight folder. We then edited the footer.php file with our customizations and the site assumed those.

How Child Themes Work

If there’s a file in the Child Theme and the Parent Theme, the Child Theme’s file will be utilized. The exception is functions.php, where code in both themes will be utilized. Child Themes are a brilliant solution to a very difficult problem. Editing core theme files is a no-no and should not be accepted by clients.

If you are looking for an agency to build out a WordPress site for you, demand that they implement a Child Theme. If they don’t know what you’re talking about, find a new agency.

Child Themes are Critical

You’ve hired an agency to build a site for you, and they’ve implemented a well-supported Parent Theme and a highly customized Child Theme. After the site is released and you complete the contract, WordPress releases an emergency update that corrects a security hole. You update WordPress and your site is now broken or blank.

If your agency had edited the Parent Theme, you’d be lost. Even if you found an updated Parent Theme, you would need to download it and troubleshoot any code changes to try to identify which correction fixes the issue. But since your agency did a great job and developed a Child Theme, you download the updated Parent Theme and install it on your hosting account. Refresh the page and everything just works.

Disclosure: I am using my Themeforest affiliate link in this article.

© 2020 DK New Media, LLC, All Rights Reserved


Viewing all articles
Browse latest Browse all 1488

Trending Articles