1

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?

  • 1
    from where and how is being called testimonial.php? – iEmanuele Sep 3 '13 at 15:39
  • 1
    This question is impossible to answer without knowing how the template files are being included. – Chip Bennett Sep 3 '13 at 16:04
  • Can you add more information regarding the base theme and maybe find out where and how the file is included in the parent theme. For starters look for testimonial.php in the parent theme. – kraftner Jun 30 '17 at 11:24
1

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 the child_theme directory.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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