Jump to content

What is the best practice to modify child theme html?


Nigel Moore
Go to solution Solved by Marc,

Recommended Posts

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 by Nigel Moore
want to emphasize that the parent is the default theme.
Link to comment
Share on other sites

  • 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".

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...