admin管理员组文章数量:1278912
I've created a child theme and I want to overwrite functions in inc/template-tags.php file. I thought if I copy this file and recreate folder structure in my child them then it will work but it doesn't? How to do it properly?
I've created a child theme and I want to overwrite functions in inc/template-tags.php file. I thought if I copy this file and recreate folder structure in my child them then it will work but it doesn't? How to do it properly?
Share Improve this question asked Oct 29, 2021 at 18:03 RaymondRaymond 1417 bronze badges1 Answer
Reset to default 1Notice how the parent theme checks if they are already defined e.g.
if ( ! function_exists( 'twenty_twenty_one_entry_meta_footer' ) ) {
...
}
Then just define them in your child theme's functions.php
file, to override the corresponding template tag.
It should work because the child theme's functions.php
file is loaded before the parent's functions.php
file that loads:
// Custom template tags for the theme.
require get_template_directory() . '/inc/template-tags.php';
本文标签: How do I override templatetagsphp in 2021 theme
版权声明:本文标题:How do I override template-tags.php in 2021 theme 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741243482a2364431.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论