For the complete documentation index, see llms.txt. This page is also available as Markdown.

Overriding templates in your theme

Copy a template into your theme and Cashback Tracker uses yours instead. Plugin updates never touch it.

wp-content/plugins/cashback-tracker/templates/_shop-card.php
                                   ↓  copy to
wp-content/themes/your-theme/_shop-card.php

Into your theme's root, not a subfolder. The plugin asks WordPress for a file of that exact name and takes the first one it finds.

When an override is the right answer

  • You need markup in an order no hook offers.

  • You are replacing a part wholesale rather than adding to it.

  • Your theme has its own card component and you want the plugin to use it.

When it is not

  • Adding a line of text or a badge — that is an action, and it keeps working after every update.

  • Changing what a row says — that is a filter. The facts list, the coupon meta row, the trust and how-it-works blocks all take one.

  • Changing colours, spacing or type — that is CSS. See Colours and CSS.

Override the smallest thing that works

A shop page is built from parts. Copying single-cashback-shop.php freezes the whole page — both layouts, every part, every hook position. Copying _shop-identity.php freezes one small file that draws a logo and a name.

Prefer the part. When the plugin improves the coupon card next release, a site that overrode _shop-identity.php gets the improvement; a site that overrode the page does not.

The full list of what you can copy is in the Template reference.

Keeping an override working

An overridden template is a copy of one moment in the plugin's history. Two things drift:

Variables. A part receives named variables — $post_id, or $coupon and $reserve_rail. New ones may be added, and an old copy simply ignores them. That is safe: it renders the older shape.

Class names. Your copy keeps emitting the classes it was written with. If the shipped stylesheet stops styling one of them, your copy loses that styling silently — nothing errors, it just looks wrong.

After a major update, look at your overrides. Compare each against the plugin's current version of the same file. diff is enough:

What you want to see is your deliberate changes and nothing else. Anything you do not recognise is a change you have been missing.

A worked example

Say every shop tile should carry your own "Verified partner" badge.

Do not copy _shop-card.php for that. Nothing in the plugin's card is wrong; you are adding to it. But the card has no action inside it, so this genuinely is an override — and the right one is the card, not the grid or the page:

One file, one addition, and the rest of the shop page keeps improving.

Last updated