admin管理员组文章数量:1430078
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
本文标签: Replace theme function
版权声明:本文标题:Replace theme function 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745525312a2661808.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论