0

I'm trying to edit some template files located in my parent theme. I was able to successfully edit some of the template files but changes made to the other files did not take effect.

After saving the changes I cleared the cache and restarted my browser but I was still unable to get the changes to take effect.

The template files in question are not core Wordpress template files but are located in the root directory of the parent theme and were copied to the same location in the child theme.

3
  • Core WordPress templates (listed here) can be overwritten by placing them in the child theme. Any other template files your theme might be using can only be overwritten if they're included using the correct template functions, like get_template_part(). If the parent theme is using a generic include to include template files, you won't be able to replace them in a child theme. That's something you'd need to take up with the author. Commented Nov 18, 2017 at 5:11
  • Hi @JacobPeattie, thanks for the explanation. I've come up against this problem before but never been able to find a satisfactory explanation.
    – jrcollins
    Commented Nov 18, 2017 at 6:31
  • 1
    @JacobPeattie could you please post your comment as an answer so I can close this thread?
    – jrcollins
    Commented Nov 18, 2017 at 6:40

1 Answer 1

3

Core WordPress templates (listed here) can be overwritten by placing them in the child theme (because WordPress itself loads them it knows to do it in a child theme friendly way). Any other template files your theme might be using can only be overwritten if they're included using the correct template functions, like get_template_part(), which will check child themes for files first. If the parent theme is using a generic include to include template files, you won't be able to replace them in a child theme. That's something you'd need to take up with the author

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.