I have my WordPress installation running using a child theme based on a theme I have bought. The original theme has templates files in a template folder /original_theme/template/testimonial.php
. I want to override one of the files inside this folder so I copied it to my child theme’s folder child_theme/template/testimonial.php
. As far as I understand the documentation on child themes this is the recommend way to apply changes to the template files. This works for the header.php
file but not for the template file I want to override. Changes are ignored and even an empty file displays the correct content. Is there anything else I have to do?
2 comments
Comments are closed.
Replacing templates via child theme only works as far as WPâs core functions are being used to locate/load that template. More complex themes might not be implementing that for their features.
In such case the code of the parent theme needs to be examined to determine how precisely that specific template is loaded and what customization options (if any) are there.
In many cases, when a theme contains a “template” directory, this directory should be omitted in the child theme. For example, rather than having
child_theme/template/testimonial.php
, put “testimonial.php directly in thechild_theme
directory.