0

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.com/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?

0

If 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.