Add child theme (advanced knowledge)
WHAT IS A CHILD THEME?
Child themes are like little carbon copies of a WordPress theme, or the parent theme, which share the same functionality. When you create a child theme, you’re making a duplicate of the parent theme’s files. Should you wish to play around with or customize the theme’s code, you can safely do so with the child theme’s files, leaving the parent theme untouched and preserved.
WHY SHOULD I USE CHILD THEMES?
By customizing the code of the child theme files rather than touching the parent theme’s, you avoid the risk of accidentally damaging the theme’s functionality, compromising the core theme files, or saving over your modifications when an update is released and implemented. This allows the parent theme to be safely updated without negating all of your hard work yet still reflecting the benefits of said update. Simply put, utilizing child themes can save you valuable time and major headaches down the line.
HOW DO I CREATE A CHILD THEME?
There are two different methods to getting your child theme up and running:
VIA YOUR FTP PROGRAM
You can directly insert your child theme folder via FTP by logging on to your program (we use FileZilla/Coda …) and navigating to your “wp-content/themes” directory.
VIA YOUR WORDPRESS DASHBOARD
Select the child theme folder ( lorelei-child-v1.1 ). Go to your WP dashboard, navigate toAppearance > Themes > Add New and upload this new theme.
ACTIVATING THE CHILD THEME
Just as you would activate any other theme, head over to your website’s WordPress dashboard. Navigate to Administration Panels > Appearance > Themes. Your newly created child theme should be listed. Click “Activate”.
CUSTOMIZING MORE THAN THE STYLESHEET
As we’ve only imported a CSS file for the child theme, all other crucial files and coding will be pulled from the parent theme’s folder. Should you wish to modify or add to any PHP files, you can easily duplicate the template file(s) from the parent theme and save it within the child theme’s folder. Be sure to keep the name of the file exactly as it is worded for the parent theme– it will be pulled first from the child theme and will override the parent theme’s file.
Now, that being said, it is very important to note that, should the developer release an update that includes modifications to any PHP files you’ve customized, the child theme’s file will override the parent theme’s and this new update will not take affect. It may be a good idea to keep a running list of any changes you make to all child theme PHP files. Should you wish to implement the author’s update, you’d have a helpful overview of what’s been adjusted.
Feel free to modify, customize, and tinker worry-free to your heart’s content! Still have questions or wish to learn more about child themes? We highly recommend looking into the additional resources listed below.