---
title: "Override template files"
source: https://support.reytheme.com/kb/override-template-files/
topic: "Code & Snippets"
description: "A template file is the small PHP file that prints one piece of a page: the logo, the cart panel, the price on a product page."
updated: 2026-08-13
---

# Override template files

A template file is the small PHP file that prints one piece of a page: the logo, the cart panel, the price on a product page. When you need to change what one of them outputs, and no setting or filter can do it, you copy that file into your child theme and edit the copy.

**Never edit the file inside the theme or the plugin itself.** Those folders are replaced wholesale on every update, and your change goes with them. A child theme is never touched by an update, which is exactly why overrides live there.

**Note:** No child theme yet? Follow [How to install the child theme](https://support.reytheme.com/kb/how-to-install-child-theme/) first. Everything below assumes the child theme is installed and active.

The rule is the same in all three cases: **keep the folder structure, change only the destination root**. A file two folders deep in the source stays two folders deep in the child theme.

### Where each file goes

| Templates from | Copy them into |
| --- | --- |
| `/wp-content/plugins/rey-core/template-parts/` | `/wp-content/themes/rey-child/rey-core/` |
| `/wp-content/themes/rey/template-parts/` | `/wp-content/themes/rey-child/template-parts/` |
| `/wp-content/plugins/woocommerce/templates/` | `/wp-content/themes/rey-child/woocommerce/` |

*The destination folders do not exist in a fresh child theme. Create them as you need them.*

Note the two renames. Rey Core's `template-parts` folder becomes `rey-core` in the child theme, so it cannot collide with the theme's own templates. WooCommerce's `templates` folder becomes `woocommerce`, which is WooCommerce's own convention, not something specific to Rey.

[![Two file trees side by side, one showing plugins/rey-core/template-parts/woocommerce/header-shopping-cart-panel.php and the other the matching themes/rey-child/rey-core/woocommerce/header-shopping-cart-panel.php, so the rename and the preserved subfolders are visible at a glance.](https://support.reytheme.com/wp-content/uploads/2021/04/SCR-20260813-pvjl-c-1024x543.webp)](https://support.reytheme.com/wp-content/uploads/2021/04/SCR-20260813-pvjl-c.webp)

#### Rey Core, an example

The cart panel that slides in from the side is this file:

```
/wp-content/plugins/rey-core/template-parts/woocommerce/header-shopping-cart-panel.php
```

Drop `template-parts/`, put `rey-core/` in its place, and keep the rest:

```
/wp-content/themes/rey-child/rey-core/woocommerce/header-shopping-cart-panel.php
```

#### Rey Theme, an example

The header logo is printed by:

```
/wp-content/themes/rey/template-parts/header/logo.php
```

Here the path is unchanged, only the theme folder differs:

```
/wp-content/themes/rey-child/template-parts/header/logo.php
```

#### WooCommerce, an example

The price block on a single product page:

```
/wp-content/plugins/woocommerce/templates/single-product/price.php
```

The `templates` folder is dropped, everything after it stays:

```
/wp-content/themes/rey-child/woocommerce/single-product/price.php
```

**Note:** Rey overrides a number of WooCommerce templates itself, to give them its own markup. If your copy of a WooCommerce template has no effect, Rey is most likely serving its own version of that piece: look for it in Rey Core's `template-parts/woocommerce/` folder and override that one instead.

### Good practice

- **Copy only the files you actually change.** Every copied file is frozen at the version you copied it from, and stops receiving fixes and improvements. Two overrides are easy to maintain, twenty are not.
- **Check your overrides after a major update.** If a template changed upstream, compare it against your copy and carry the changes across. WooCommerce does this check for you under *WooCommerce → Status*, which lists outdated template overrides.
- **Try a filter first.** Many outputs can be changed with a hook from [functions.php](https://support.reytheme.com/kb/how-to-add-custom-code-in-child-themes-functions-php/), and a hook survives updates without any maintenance. Overriding a whole template is the heavier option, worth it when the markup itself has to change.

### The override is not being picked up

- **The child theme is not the active theme.** Check *Appearance → Themes*: it should be Rey Child, not Rey.
- **The path or the file name is off by something.** They have to match exactly, including the case of every letter. Most servers are case sensitive even when your own computer is not.
- **You renamed the wrong folder.** For Rey Core it is `template-parts` that becomes `rey-core`. The subfolders after it stay as they are.
- **Something is caching it.** Rey remembers which file it resolved for each template. On a site with a persistent object cache (Redis, Memcached), flush that cache after adding a new override file. Page caching and PHP OPcache are worth clearing too.
