# Themes

URL: https://rustpress.witsberry.com/themes/

> Build RustPress themes with Jinja-style templates, the WordPress template hierarchy, Tailwind v4 and live theme options, or convert a WordPress theme.

This page explains how RustPress themes are built, customised, converted from WordPress, exported and installed.

## What a theme is

A RustPress theme is a folder with a `style.css` header, like a WordPress theme, and Jinja-style HTML templates instead of PHP files. `templates/index.html` is required. Shared pieces such as headers and footers go in `parts/`, and `parts/base.html` with a `{% block main %}` is the layout plugins’ templates wrap.

```
/*
Theme Name: My Theme
Version: 1.0.0
Template: twentyrust            (optional: makes this a child theme)
Requires Plugins: shop-core     (optional)
Requires RustPress: 0.1.4       (optional)
*/
```

## Templates

Templates use MiniJinja syntax:

*   `{{ }}` prints a value.
*   `{% if %}` and `{% for %}` handle conditions and loops.
*   `{% extends %}`, `{% block %}` and `{% include %}` share layout between templates.

Templates get the site (name, address, logo, icon), the navigation, the current post or list of posts, pagination, archive details, comments and the theme’s options. Print the core’s hooks: `{{ wp_head|safe }}` in `<head>`, `{{ admin_bar|safe }}` and `{{ wp_body_open|safe }}` after `<body>`, and `{{ wp_footer|safe }}` before `</body>`.

## Template hierarchy

RustPress picks a template the WordPress way, from most specific to least specific:

| View                       | Templates                                                     |
| -------------------------- | ------------------------------------------------------------- |
| Front page                 | `front-page`                                                  |
| Blog home                  | `home`                                                        |
| Single post or custom type | `single-{type}-{slug}`, `single-{type}`, `single`, `singular` |
| Page                       | `page-{slug}`, `page-{id}`, `page`, `singular`                |
| Category                   | `category-{slug}`, `category`                                 |
| Tag                        | `tag-{slug}`, `tag`                                           |
| Custom taxonomy            | `taxonomy-{tax}-{term}`, `taxonomy`                           |
| Author                     | `author`                                                      |
| Date                       | `date`                                                        |
| Post type archive          | `archive-{type}`, `archive`                                   |
| Search results             | `search`                                                      |
| Not found                  | `404`                                                         |
| Fallback for everything    | `index`                                                       |

Plugins may ship templates for their own content types (`single-product.html`, `archive-product.html`). A theme overrides one by shipping a file with the same name.

## SEO, icons and the logo come from the core

Since 0.1.4, `{{ wp_head }}` prints the description, robots, canonical link, Open Graph and X cards and JSON-LD (**Settings › SEO**), plus the favicon, Apple touch icon and web manifest made from the site icon (**Settings › General**). Themes add none of these. Use `site.logo` for the header logo, with the site name as alt text and fallback. Use one `h1` per page, headings in order, real links and buttons, and `<main>`, `<nav>` and `<article>`, so search engines, screen readers and AI agents read the page right.

## Child themes

Child themes change only what they contain, so you can change a theme without editing it. The bundled Twenty Rust theme comes with a dark child theme you can use as an example.

## Theme options and the live customizer

A theme declares its settings in `theme-options.json`: text, colours, Media Library images, links, pages, selects and repeaters. Site owners change them under **Appearance › Theme Options**, and changes preview live before saving. Templates read them as `options.<id>`; colours and numbers are also CSS variables (`--opt-<id>`).

## Tailwind v4 and assets

Themes can use Tailwind v4, compiled ahead of time with `rp theme build`; the standalone Tailwind tool is downloaded and checked once. Link scripts and styles by their plain names (`{{ theme_url }}css/app.css`): RustPress serves them under content-hashed names cached for a year and renamed the moment the file changes, so never add `?ver=` or other cache-busting.

## Editing theme files

The file editors for themes and plugins check syntax and undo a change automatically if it breaks the site. Set `disallow_file_edit = true` to turn them off on production.

## Building themes with AI agents

The Theme Designer and Site Builder agents build option-driven Tailwind themes in a workspace, preview them privately in a sandbox, and propose the install for your approval. See [AI agents](/ai-agents/).

## Converting WordPress themes

Upload a WordPress theme zip under **Appearance › Add New Theme**, or run `rp theme install FILE.zip --convert`.

*   **Block themes convert fully:** theme.json styles and fonts, templates, parts, patterns, query loops and navigation.
*   **Classic PHP themes** keep their stylesheet and assets on starter templates.

Each conversion writes `CONVERSION.md`, listing what was left out. An agent can refine the rest, or the WordPress Migrator agent can rebuild the theme. More in [Moving from WordPress](/moving-from-wordpress/).

## Exporting and installing themes

```
rp theme export SLUG                                   # one theme as a zip
rp backup                                              # every theme and plugin in one zip
rp theme install FILE.zip [--replace] [--activate] [--convert]
```

The Themes screen has **Export** on each theme and **Export all**, and **AI › Changes** downloads workspace projects. A theme that requires a plugin isn’t activated until that plugin is active.

## Twenty Rust

RustPress ships with the Twenty Rust theme and its dark child theme. They are a working starting point for your own theme. All theme commands are in the [Command reference](/command-reference/).
