How do I override template-tags.php in 2021 theme

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?

Topic theme-twenty-twenty-one Wordpress

Category Web


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';

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.