PiscesQuickstart

Theme development

Package Gutenberg templates, reusable parts, patterns, and CSS for a Pisces site.

Understand the layers

A Pisces theme is a JSON manifest with an identity, version, and block documents. The normal shell supplies the page frame. Set "shell": "standalone" when the theme supplies its own frame through its templates and parts. Pisces assembles the HTML document and provides site, route, and post context in either mode.

Resource What it controls
Templates Layout for home, single, page, archive, and not_found
Custom templates Named layouts a site can assign to a route using Design
Parts Shared regions such as a masthead or an article introduction
Patterns Reusable block compositions available in the inserter
Style and assets Default color and style tokens, CSS, PNG and WebP images, WOFF and WOFF2 fonts

Single and page templates need a core/post-content block. For a template used on a specific page or post, put Post Content outside any query loop. On archive or search routes, a Query Loop with "inherit": true receives the current results and pagination.

Build Margin Theme

The complete Margin manifest changes the single-post layout, adds a reusable article part, and makes a Field observation pattern available in the editor. It keeps the standard Pisces shell.

Save the manifest as margin-theme.json. Against the same data directory as Quickstart, install and select it for journal.

theme=$(pisces theme-install margin-theme.json --site journal)
pisces theme-select journal "$theme"

Open a published post to see the article layout and From the reading desk. In Gutenberg, find Field observation in the pattern inserter. The template in the manifest uses this block markup.

<!-- wp:group {"className":"margin-article"} -->
<div class="wp-block-group margin-article">
<!-- wp:post-title {"level":1} /-->
<!-- wp:post-date /-->
<!-- wp:template-part {"slug":"reading-desk"} /-->
<!-- wp:post-content /-->
</div>
<!-- /wp:group -->

The CSS asset sets the reading width and styles the shared part. Package markup can reference images or fonts at /_theme-package/current/ASSET, and CSS can reference packaged assets with relative URLs. Site operators install CSS as trusted presentation assets.

Preview, publish, and update

Open Design → Manage themes to install or activate a package from the admin. Then open a public route in Design to inspect its template and dependencies. Edit a part or style, preview at desktop and mobile widths, and save the design together when ready.

Saved site overrides take precedence over theme defaults and persist when switching themes. Use Reset to theme to remove a theme-backed document override. Use pisces theme-select journal to return to the default theme. For a new version, update the manifest version, install it, and select its digest. Check existing overrides against the updated template and parts.

A manifest installed without --site goes in the shared catalog. A site-specific installation gives access only to that site unless the same package is already shared. When moving a site archive, install the selected package on the destination before checking affected routes.

Use the Design API

On project builds that include Design v1, a tool can read the design snapshot, inspect the effective layout for a route, and send a revision-checked changeset. Use the authenticated admin origin.

Method and route Result
GET /api/sites/journal/design/v1 Current revision, editable documents, and overrides
GET /api/sites/journal/design/v1/route?path=%2Fabout%2F Effective template, explicit assignment, and referenced documents
POST /api/sites/journal/design/v1/preview Rendered HTML for a candidate design
PUT /api/sites/journal/design/v1 Publish the changeset or return 409 for a stale revision

For example, a changeset can update a theme part. Replace the revision and ID with values from the snapshot.

{
  "expected_revision": 4,
  "documents": [
    {
      "id": "theme:margin/wp_template_part/reading-desk",
      "source": {
        "format": "gutenberg-blocks",
        "version": 1,
        "content": "<!-- wp:paragraph --><p>Notebook dispatch</p><!-- /wp:paragraph -->"
      }
    }
  ]
}

For preview, send the same JSON as the URL-encoded draft field along with a local path. For publication, send the JSON body and a matching admin Origin. One accepted changeset publishes as one design revision.