0

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?

1 Answer 1

1

Notice 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';
1
  • 1
    Thanks, yes I already figured it out.
    – Raymond
    Oct 30, 2021 at 13:16

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.