Nigel Moore Posted October 26, 2022 Posted October 26, 2022 (edited) Hello, what is the best practice to modify child theme that inherits parent theme(Default)? I would like to modify our current child theme, but dont want to overwrite it when there is a new update in parent (default) theme. Thanks -Allan Edited October 26, 2022 by Nigel Moore want to emphasize that the parent is the default theme. The Old Man 1
Marc Posted October 26, 2022 Posted October 26, 2022 Its not clear what you mean here. Anything that is modified would not be overwritten, no matter which theme it is in (child or otherwise)
Management Matt Posted October 26, 2022 Management Posted October 26, 2022 To expand on that a little, as it can be a little confusing. 😄 Consider: - Blue Theme '-- Child of Blue Theme If you changed template "row" in Child of Blue Theme to: <h1>Child!</h1> When viewing the page this template is used, you will see "Child". Now consider you change the same template "row" but in the Blue Theme to: <h1>Parent!</h1> Although Blue Theme now has changes, the Child of Blue Theme's changes will overrule the parent, so you will still see: "Child". SeNioR- and The Old Man 1 1
Nigel Moore Posted October 27, 2022 Author Posted October 27, 2022 18 hours ago, Marc Stridgen said: Its not clear what you mean here. Anything that is modified would not be overwritten, no matter which theme it is in (child or otherwise) Sorry if it confused you, what I mean, is that, we have this problem in our current theme setup, wherein if there is a update in IPB core and new hook or udpated hook, our theme is not updated since it is a custom theme. What I mean, is that, if parent theme is updated we want to make sure that the child theme is also updated with new hooks update. I just read this article I don't know how include template works, but it seems that if you go with the include template it means you modify the template and if there is a new update you need to re-add it, correct? So the effective way I see is using the plugin and use theme hook. Similar with WP parent and child theme, where when you modify the parent theme using child, you just tap into the hook of the parent theme to alter design or functionality. Im a WP dev and IPB is new to me. --ALlan
Marc Posted October 27, 2022 Posted October 27, 2022 The child template would work the same as the parent template. If you have a modified template, that template will not be updated in any way
Nigel Moore Posted October 27, 2022 Author Posted October 27, 2022 57 minutes ago, Marc Stridgen said: The child template would work the same as the parent template. If you have a modified template, that template will not be updated in any way If I edit HTML or CSS in child theme, and if there is a new update on the parent theme, and it happens that the template I edited has a new update, do I need to copy that updated template from parent to child? Im thinking of modify child template and adding large block of HTML code. Im just worried that if there is a new update on parent template and my child template cant use that new update. How does that work in that kind of case? --Allan
Management Matt Posted October 27, 2022 Management Posted October 27, 2022 Yes, so any templates you modify are not edited or changed during an upgrade, so you will need to manually add any elements that have changed. You can use our theme diff tool to see what has changed between releases. Nigel Moore 1
Nigel Moore Posted October 28, 2022 Author Posted October 28, 2022 15 hours ago, Matt said: Yes, so any templates you modify are not edited or changed during an upgrade, so you will need to manually add any elements that have changed. You can use our theme diff tool to see what has changed between releases. Thank you for the confirmation. What that said, its better to create a plugin and use the theme hook. --Allan
Nigel Moore Posted October 28, 2022 Author Posted October 28, 2022 Theres a typo over there, it should say "With that said..." not "What that said" -Allan
Solution Marc Posted October 28, 2022 Solution Posted October 28, 2022 If you wish for both templates to be updated, and to have updates to templates, that would be the way to go Nigel Moore 1
Recommended Posts