DPDK Architecture  ->  Wordpress (stable)

Child Themes

While many themes provide us with a wide array of options and design choices, not everything is customizable directly from the CMS without touching the underlying code. This is why every project uses a child theme as an addon to the original parent theme. By using a child theme, we can add additional code or alter/replace existing files in the parent theme without exposing the actual parent theme. In short, child themes inherit the features of a theme’s core, including full compatibility with all plugins. They adapt different styles and appearances, because child themes can make a parent theme look completely different. This is great for two main reasons.

  • This allows us to perform updates on the parent theme, without erasing our self-added code or resetting any changes we’ve made to the code.

Note: This does not guarantee every update is compatible. Occasionally, a theme update alters the code, or removes/deprecates functions that are used by the child theme. It is always recommended testing out a theme update in a staging environment first. Locally, update the theme by overwriting the current theme folder with the updated version, and see if it produces any errors or compatibility issues.''

  • It allows us to directly separate and distinguish our own changes and files. Since the child theme is handled in a separate directory from the parent theme, it is easier to spot the hierarchy and keep your projects organized. This, in turn, gives us the option to use the child theme on other projects or copy specific bits of code not available in the main theme.

For some theme-registered functionalities or hardcoded designs, touching the code of the parent theme is required to achieve the wishes from client/design. Since these changes are removed upon the next theme update (it overwrites the file), editing the parent theme is not recommended and should only be done as an exception. The workflow is only to add or edit files from within the child theme. To counteract the code-removal upon updating, patch files are created for all changes within the parent theme. These can be found in the /_resources/patches folder.

Last modifiedThursday, January 28, 2021, 3:10:42 PM UTC
Last authorGlenn de Haan
Commit ID0e617f4