Parent theme hooks in child theme

Plugin Development
  • Hi,
    I want to customize the Persona theme a little bit and started by looking at nodebb-theme-quickstart. It is clear how to replace one or more templates but I am wondering about the hooks defined in the parent theme. Should I copy all of them in my child theme if I want to keep all functionality of the parent them ? Or the parent theme is loaded anyway and the hooks code is loaded also and I can skip copying them in my child theme ?

    The theme-quickstart seems to suggest I can redefine only a single hook so seem the rest are supposed be be called from the parent theme. But at the same time, the scripts array in plugin.json defines references to parent theme scripts so seems those scripts are not loaded automatically.

  • After some more code digging and experiments I can answer my own question. A theme is a normal plugin and as such does not inherit any behavior from other plugins.
    So you need to copy everything you need from the base theme library.js to your child theme. And of course, you need to declare client scripts explicitly.
    Loading of missing templates from base theme is the only link between the base and the child theme.

Suggested Topics