Hallo @wdekleijn,
to override a parent theme’s template file (link-template.php
in this case) in a child theme, you typically don’t need to add any code to the functions.php
file of your child theme. Instead, you just need to replicate the file structure of the parent theme in your child theme and place the modified link-template.php
file in the appropriate location within your child theme directory.
Here’s what you need to do:
- Create a child theme if you haven’t already done so. This involves creating a new directory in the
wp-content/themes/
directory with a unique name and adding a style.css
file with the necessary information, including the Template
header referencing the parent theme’s directory name.
- Within your child theme directory, create the same directory structure as the parent theme. For example, if the parent theme’s
link-template.php
file is located in wp-content/themes/parent-theme/includes/
, you should create a corresponding includes
directory within your child theme directory.
- Place your modified version of
link-template.php
into the appropriate directory within your child theme. So, in this example, you’d place it in wp-content/themes/child-theme/includes/
.
WordPress will automatically prioritize files in the child theme over those in the parent theme. So, when WordPress looks for link-template.php
, it will first check the child theme’s directory and use that version if it exists. If not, it will fall back to the parent theme’s version.
No additional code in the functions.php
file of your child theme is necessary for overriding template files.
I hope this is helpful ??
Greetings
Benjamin Zekavica