I am a PHP developer but I am new to WordPress so there may be simple things I don't know how to do.
I made a change on a theme file to change the behavior of the theme. Only changed 6 words and everything inside of the same function.
You can see the original and the modified file comparission here:
So, I know this changes can be lost on a theme update... and I am not very attracted by this idea... so, I made a child theme, copied the file and made the changes there. Everything is ok, it works very nice but...
I wonder if a theme update where they modify a line of the same file but in another function may affect my site. And if so, is there anything I can do?
I don't know, maybe I can replace the modified function from the functions.php
file instead of a child theme.
If that is possible, how can I do it?
I am a PHP developer but I am new to WordPress so there may be simple things I don't know how to do.
I made a change on a theme file to change the behavior of the theme. Only changed 6 words and everything inside of the same function.
You can see the original and the modified file comparission here: https://www.diffnow/report/5321s
So, I know this changes can be lost on a theme update... and I am not very attracted by this idea... so, I made a child theme, copied the file and made the changes there. Everything is ok, it works very nice but...
I wonder if a theme update where they modify a line of the same file but in another function may affect my site. And if so, is there anything I can do?
I don't know, maybe I can replace the modified function from the functions.php
file instead of a child theme.
If that is possible, how can I do it?
Share Improve this question asked May 3, 2019 at 22:07 Just a nice guyJust a nice guy 1116 bronze badges1 Answer
Reset to default 0If the Theme is well developed they wrapped functions in an
if (!function_exists(something))
So the you can overwrite just the function by having it in your child themes function.php
You may also check if your theme provides hooks and filters to customize behaviour.
If that isn't the case you can either do what you already did... and no ... if developers changes code you have to deal with it. So I recommend to well document your changes. It's a good idea to put everything in a Git repository to just run a diff on file changes