I am trying to overwrite a template file (tpl-footer.php) in my child-theme.
According to the wordpress docs this should be possible just by adding the file with the same name and the same path into the child-theme. When I do so, nothing happens.
The theme I use is snsnitan
Does anyone know what I am missing?
Do I need to overwrite more files?
The footer.php in parent theme has just:
<?php wp_footer(); ?> </body></html>
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
If the file is included via get_template_part or a part of the template hierarchy, then yes, create a file with the same name in a child theme and WordPress will preferentially load that file.
If the file is included via include/require, then no, those are PHP language features, not WordPress functions, there is no way to intercept or override them so that your file is loaded instead. Either fork the theme or contact the theme support route. The author may have provided alternative methods of overriding the template, or be able to add support for it.
Remember, child themes let you preferentially load child theme templates via the template hierarchy and get_template_part. They can’t auto-replace arbitrary PHP files, CSS, JS etc files by putting them in a child theme and expecting them to be used instead
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0