Change code in child theme – Three different ways?
-
I know there have been various questions like this before, and I have read many of the threads concering this issue, but I am yet to understand what is considered best practice.
I use a child theme. I want to make som changes in the code. What is the best way to do it? I have understood that there are mainly three ways.
1. Copy entire parent theme file to the child theme and then make the changes in that file.
Downside: It will not let my child-theme take advantage of parent-theme updates.2. Make changes in CSS. By changing CSS it is possible to turn off features. Example:
.foo { display: none; }
Downside: The code will still be run, which means that performance will not be enhanced.
3. Make changes in child-theme functions.php.
Take away functions in parent theme by creating an empty functions.php file in the chile-theme and the use functions likeremove_parent_theme_features()
to turn off features.So, from what I have understood these are the three ways to do it. It seems to me that the third way would be the best, since it will enhance performance (by getting rid of excess code) and not mess upp future theme-updates.
So, should option three be considered best practice, or have i misunderstood this all together? Or are there other ways to solve this problem?
- The topic ‘Change code in child theme – Three different ways?’ is closed to new replies.