Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted October 26, 20222 yr 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, 20222 yr by Nigel Moore want to emphasize that the parent is the default theme.
October 26, 20222 yr 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)
October 26, 20222 yr Management 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".
October 27, 20222 yr Author 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
October 27, 20222 yr 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
October 27, 20222 yr Author 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
October 27, 20222 yr Management 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.
October 28, 20222 yr Author 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
October 28, 20222 yr Author Theres a typo over there, it should say "With that said..." not "What that said" -Allan
October 28, 20222 yr Solution If you wish for both templates to be updated, and to have updates to templates, that would be the way to go