> For the complete documentation index, see [llms.txt](https://ctracker-docs.keywordrush.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ctracker-docs.keywordrush.com/for-developers/template-reference.md).

# Template reference

Every piece of front-end markup Cashback Tracker prints comes from a file in the plugin's `templates/` folder, and every one of them can be replaced by a copy in your theme. This page lists them and the variables each receives.

For how overriding works and when to reach for it, see [Overriding templates in your theme](/putting-it-on-your-pages/overriding-templates.md).

### How a template is found

When the plugin needs `_shop-card.php` it asks WordPress for a theme file of that name first, and falls back to its own. A file in your theme's root wins; nothing else is consulted.

The three page templates work the same way but go through WordPress's own template hierarchy, so a theme copy of `single-cashback-shop.php` replaces the page wholesale.

### Page templates

| Template                            | Draws                                                                                                      |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `single-cashback-shop.php`          | One shop page. Runs the loop, picks a layout, fires the outer hooks — everything visible comes from a part |
| `archive-cbtrkr_shop.php`           | The shop directory                                                                                         |
| `taxonomy-cbtrkr_shop_category.php` | One shop category                                                                                          |

### Shop page layouts

A shop page is assembled from **parts**, arranged by one of two **layouts**. Both layouts draw the same parts; only the arrangement differs, and that lives in the stylesheet. Which one is used comes from `Settings → Storefront → Shop page layout`.

| Template                 | Draws                                                        |
| ------------------------ | ------------------------------------------------------------ |
| `_shop-layout-panel.php` | The offer as a card in a column beside the content           |
| `_shop-layout-hero.php`  | The offer as a band across the top, content left, rail right |

Both receive `$post_id`.

### Shop page parts

Every one receives a single variable, `$post_id`, and every one renders nothing when it has nothing to show.

| Template                 | Draws                                                                             |
| ------------------------ | --------------------------------------------------------------------------------- |
| `_shop-breadcrumb.php`   | All shops › Category                                                              |
| `_shop-identity.php`     | Logo, shop name, star rating                                                      |
| `_shop-rate.php`         | The cashback rate, or the top offer on a coupon site                              |
| `_shop-cta.php`          | The Go to shop button                                                             |
| `_shop-facts.php`        | Approved in, paid out in, categories, website                                     |
| `_shop-coupon-stats.php` | Coupon highlights: total offers, codes, best discount, last verified              |
| `_shop-how.php`          | An empty slot — see [Adding your own blocks](/for-developers/shop-page-blocks.md) |
| `_shop-trust.php`        | A second empty slot                                                               |
| `_shop-terms.php`        | Cashback terms and exclusions, as disclosures                                     |
| `_shop-related.php`      | Related shops. Also takes `$limit` and `$cols`                                    |
| `_shop-actionbar.php`    | The bar pinned to the bottom of the viewport on phones                            |
| `_shop-reviews.php`      | Ratings and member reviews                                                        |
| `_review-item.php`       | One review. Takes `$review`, `$rating`, `$verified`                               |
| `_cashback_linkwise.php` | A per-category rate breakdown, for Linkwise shops. Takes `$viewer`                |

### Shop lists

| Template                      | Draws                                      | Variables                                                               |
| ----------------------------- | ------------------------------------------ | ----------------------------------------------------------------------- |
| `cashback-shops-grid.php`     | The `[cashback-shops]` grid                | `$shop_pages`, `$a`                                                     |
| `cashback-shops-widget.php`   | The compact grid a sidebar wants           | `$shop_pages`, `$a`                                                     |
| `cashback-shops-alphabet.php` | The A–Z listing                            | `$shop_pages`, `$a`                                                     |
| `_shop-card.php`              | One shop tile                              | `$shop_page`, and optionally `$compact`, `$image_height`, `$item_class` |
| `_shop-filter-bar.php`        | Category links, A–Z strip, search and sort | `$criteria`, `$base_url`                                                |
| `_shop-pager.php`             | Directory pagination                       | `$pager`, `$page_base_url`                                              |

**`$a`** is the normalised shortcode attributes. A template reads keys from it rather than being passed each one, which is why a theme copy keeps working when a new attribute is added.

**`_shop-card.php`** draws the shop's name and its rate in both forms. `$compact` drops the tagline and the star rating — it makes the card smaller, not emptier.

### Coupons

| Template               | Draws                                    | Variables                                    |
| ---------------------- | ---------------------------------------- | -------------------------------------------- |
| `cashback-coupons.php` | The `[cashback-coupons]` wrapper         | `$coupons`, `$a`                             |
| `_coupon_list.php`     | The list: header, cards, expired section | `$coupons`, `$a`, `$expired_coupons`         |
| `_coupon-card.php`     | One coupon                               | `$coupon`, `$a`, `$reserve_rail`, `$expired` |
| `_coupon-expired.php`  | The *Recently expired* disclosure        | `$coupons`, `$a`                             |
| `coupons-widget.php`   | The compact one-column list              | `$coupons`, `$a`                             |

**`$reserve_rail`** is decided by the *list*, not the card: if any coupon in a list has a discount figure, every card keeps the column so titles stay aligned. A card cannot work this out for itself, because the answer depends on its neighbours.

### The member area

| Template                           | Draws                                                                             |
| ---------------------------------- | --------------------------------------------------------------------------------- |
| `cashback-account.php`             | The shell. Fires the outer hooks, renders the rail, prints the tab — nothing else |
| `cashback-account-dashboard.php`   | Recent activity                                                                   |
| `cashback-account-history.php`     | Cashback history                                                                  |
| `cashback-account-payouts.php`     | Payout figures, the request form and past requests                                |
| `cashback-account-referrals.php`   | The member's invite link and referrals                                            |
| `cashback-account-login.php`       | What a logged-out visitor sees                                                    |
| `cashback-account-unavailable.php` | What shows when the member area is off                                            |
| `cashback-balance.php`             | The `[cashback-balance]` figure                                                   |

Whether the rail sits beside the body or above it as a band is decided in `account.css` by a container query, not by a second template.

### Member area parts

| Template                    | Draws                                        | Variables                                                                              |
| --------------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------- |
| `_account-rail.php`         | The balance card, the rail hooks and the nav | `$tabs`, `$tab_urls`, `$active_tab`, `$balances`, `$payout_url`, `$user_id`            |
| `_account-balance-card.php` | Available, pending, the payout button        | `$balances`, `$payout_url`, `$active_tab`                                              |
| `_account-nav.php`          | The tab list                                 | `$tabs`, `$tab_urls`, `$active_tab`                                                    |
| `_account-activity.php`     | A list of rows, or the empty state           | `$entries`, `$empty_title`, `$empty_text`, and optionally `$empty_url`, `$empty_label` |
| `_account-row.php`          | One line of a member's money                 | `$entry`                                                                               |
| `_account-empty.php`        | An empty state with a way out                | `$title`, `$text`, and optionally `$url`, `$label`                                     |
| `_account-pager.php`        | Previous / next and the page count           | `$page`, `$pages`, `$base_url`, `$page_query_var`                                      |
| `_account-stat.php`         | One labelled figure                          | `$label`, `$value`, `$hint` (optional)                                                 |
| `_account-payout-form.php`  | Method cards, fields, amount, submit         | `$balances`, `$methods`, `$minimum`, `$action_url`, `$nonce_action`, `$in_woo`         |

Most of what you would override a member-area template for is a [hook](/for-developers/member-area-hooks.md) instead.

### Adding a template of your own

`TemplateManager` will render any file you put in your theme, so a custom part is a file plus a call:

```php
add_action('cbtrkr_shop_sidebar_bottom', function ($post_id) {
    echo \CashbackTracker\application\components\TemplateManager::getInstance()
        ->render('my-shop-extra', array('post_id' => $post_id));
});
```

`my-shop-extra.php` in your theme root is then found and rendered. It receives whatever you pass in the second argument.

### Related

* [Overriding templates in your theme](/putting-it-on-your-pages/overriding-templates.md)
* [Adding your own blocks to a shop page](/for-developers/shop-page-blocks.md)
* [Colours and CSS](/putting-it-on-your-pages/colors-and-css.md)
