Themes
Themes define how Batoi Press renders public pages and posts. A theme should keep presentation separate from stored content.
Theme Contract 1.0.0
In the Press 4.0.9 bundle, Versatile landing-page heroes, feature sections, and dynamic blocks align with navigation on desktop and mobile. Standard prose retains its narrower reading width. Check custom templates separately after upgrading.
The Press 4.0.10 package includes **Batoi Versatile 3.3.0**. Press and theme versions identify different components; the theme remains version 3.3.0. The bundled manifest declares contract 1.0.0, PHP >=8.3.0 and <9.0.0, and Press >=3.2.4 and <5.0.0.
The contract supports compatibility bounds, palette defaults, and required email, block-posts, block-gallery, block-products, and block-widget partials. Email and content-block presentation belongs in theme partials, not duplicated page markup. Legacy manifests receive compatibility defaults, but custom themes still need preview and compatibility review before activation.
Back up default-theme customizations before upgrading. Verify light/dark palettes, header/footer, keyboard focus after mobile navigation closes, email rendering, content blocks, and static export. Existing Appearance controls remain the preferred way to change logos, theme mode, colors, and footer content.
Convert an Exchange Template
Press 4.0.3 explains how to convert a static Exchange template into a native Press theme. The bundled Versatile theme is already native and needs no conversion.
- Inspect the original ZIP in Press and save **Compatibility report JSON**. Keep the original ZIP unchanged.
- In Batoi Build, select a Batoi Press App, open **Press Theme Converter**, and submit both files under **Start Conversion**.
- Review the generated layouts, accessibility and rendering checks, and any discarded behavior. An authorized reviewer approves and signs the result.
- Download the ZIP and detached signature envelope. Verify the envelope and ZIP digest against the trusted Build signing key before importing. Press theme inspection checks the native structure; it does not verify that envelope.
- In **Admin > Themes > Inspect and Upload**, upload the verified ZIP and preview the inactive theme before activating it.
For a local port, duplicate the bundled theme on a test installation, retain its manifest and required layouts, adapt the markup and local assets, and review template scripts before including them. Package the result and follow the inactive upload and preview workflow.
Theme Goals
4.0.1 Presentation and Theme Drafts
Local font management, gallery rendering, and theme presentation compatibility improve in 4.0.1. Check existing gallery URLs, publication status, lightbox controls, carousels, FAQ panels, icons, and backgrounds after upgrading. Restore values already lost by an earlier save from a backup; compatibility handling cannot reconstruct missing content.
The portable UIF Theme Kit and owner-only MCP/API theme drafts are previews. Draft creation validates and stores a private definition; it cannot install or activate the theme. Use the ordinary package review, inactive upload, preview, and explicit activation workflow. Keep encryption support available for private drafts. Check the upgrade and preservation guide before changing an installed theme.
- Keep layout and visual design outside content files.
- Use reusable templates for pages, posts, navigation, and shared sections.
- Keep uploaded assets in the typed asset store so the
/assets/{path}route and static exporter can resolve them consistently. - Keep private configuration outside direct public access.
Typical Theme Responsibilities
- Page shell and header.
- Navigation and footer.
- Page and post layouts.
- Content body rendering.
- CSS, JavaScript, image, font, and declared theme assets.
- Site-managed text, logo, and logo-plus-text public branding modes.
- Admin-managed theme activation, preview, duplication, template editing, snapshots, and restore.
Custom CSS and JavaScript uploads are stored separately from versioned third-party libraries. A library package declares its CSS and JavaScript entry points in a root library.json; administrators can install multiple versions, activate one version per library, and choose whether its entries load globally in the public theme. Theme-owned files remain in the theme directory.
Theme manifests are normalized to a schema-versioned contract. Themes can declare ordered styles and scripts, media attributes, defer, async, module loading, and bundled assets served through safe /theme-assets/{theme}/{path} URLs. Layouts and partials receive theme and branding context so public headers can render configured site identity without hardcoding a logo.
The bundled Batoi Versatile theme extends the default presentation surface for company, service, editorial, campaign, documentation, and product-catalogue pages. Version 3.3.0 supports professional primary and footer menu locations, stable hierarchy, dropdowns, nested children, mega menus, keyboard controls, mobile behavior, static-export parity, featured post images with alternative text, post subtitles and previous/next navigation, hierarchical posts, configurable blog pagination, per-page content blocks, scoped page CSS/JavaScript, latest-post sections, post sidebar layouts, reusable sidebar widgets, responsive navigation, structured footer markup, appearance controls, alternate dark logos, fonts, reusable hero/section/card/statistics/product/form/contact components, and manifest-declared page templates such as landing, shop, product, cart, checkout, customer account, and contact. These layouts support presentation and catalogues. Press 4.0.1 separately includes a default-off Stripe Checkout store preview; enabling it requires merchant configuration and sandbox acceptance. Static exports remain catalogue-only.
Batoi Versatile is listed on Batoi Exchange as a Website Themes asset. The Exchange record is the public catalog and trust surface for theme version, documentation, compatibility, release provenance, and support ownership.
The default theme uses these layout files:
radpress/theme/default/layouts/base.php
radpress/theme/default/layouts/page.php
radpress/theme/default/layouts/post.php
radpress/theme/default/layouts/blog.php
radpress/theme/default/layouts/archive.php
radpress/theme/default/layouts/404.php
radpress/theme/default/partials/header.php
radpress/theme/default/partials/footer.php
radpress/theme/default/theme.jsonTheme layouts receive sanitized content and metadata from the engine. Batoi Press 3.1.0 bundles Batoi Versatile 3.3.0, adding Open Graph/Twitter rendering, labeled UIF footer icons, improved footer contrast, and reliable Load More visibility and final-page removal. Ordinary pagination remains available without JavaScript. Theme asset URLs incorporate content fingerprints so changed files refresh without manually clearing browser caches.
Under Appearance, footer icon links accept safe UIF names, for example RSS | /feed.xml | uif:rss-feed. Labels remain visible, HTML is not accepted, and up to 12 links are supported. Check both color modes and keyboard use after saving.
The template source editor now uses the full available width. Back up customizations before a Press update. The 4.0.1 updater can preserve customized bundled themes; older updaters need the verified bootstrap procedure before this first protected upgrade. See update precautions.
Use /admin/themes for theme upload, activation, installed-theme duplication, same-slug upgrade, and previews for home, page, post, blog, archive, and 404 layouts. Duplicating an installed theme lets an administrator provide an editable theme name while Batoi Press generates a unique slug. Theme ZIP uploads ignore harmless macOS metadata entries, but valid theme packages still require theme.json and documented PHP layouts. Legacy Batoi theme archives that only contain templates/*.json are not converted during upload and should be rejected as incompatible. Use /admin/theme-templates for constrained edits to supported theme files such as partials/header.php, partials/footer.php, layouts/base.php, the Contact layout, and bundled theme CSS or JavaScript files. Optional CSS, JavaScript, and Contact layout files may start with safe starter content and be created when saved.
Upload a Theme
- Prepare one ZIP file whose root contains
theme.json. Do not wrap the theme in an extra parent directory. - Include only the layouts, partials, styles, scripts, images, fonts, and declared assets needed by the theme.
- Give every theme a unique slug and a human-readable name. For an upgrade, retain the existing slug and increase the version.
- Sign in to Batoi Press as an administrator and open
/admin/themes. - Select **Upload Theme**, choose the ZIP file, and review the validation result before installing it.
- Preview the installed theme against the home, page, post, blog, archive, and 404 surfaces.
- Check primary and footer navigation, keyboard use, mobile behavior, light and dark modes when supported, image alternative text, and error pages.
- Activate the theme only after preview verification. Keep the previously active theme available until the public site has been checked.
An upload must be rejected when theme.json is missing, required layouts are absent, paths escape the theme directory, PHP is placed in an unsupported file, or the archive uses an incompatible legacy format. Uploading a theme does not activate it.
Author a Batoi Press Theme with UIF
UIF is optional for public themes. When you use it, load a local, versioned UIF stylesheet and script declared by the theme instead of fetching an unpinned runtime from a third party.
- Start with the Batoi Press theme directory contract and create
theme.json,layouts/,partials/, andassets/. - Define the base document, skip link, header, primary navigation, main landmark, and footer in
layouts/base.phpand the shared partials. - Add page, post, blog, archive, and 404 layouts. Treat all content passed to the theme as data that must be escaped for its output context.
- Copy the approved UIF distribution into the theme assets or declare the bundled local assets supported by the target Press release.
- Use semantic UIF classes and tokens for layout, controls, cards, tables, notices, and typography. Keep content fields independent of presentation classes.
- Declare ordered CSS and JavaScript entries in
theme.json, including module,defer,async, and media behavior where applicable. - Test without JavaScript first, then verify progressive enhancement, reduced motion, keyboard navigation, zoom, narrow screens, and both color modes.
- Package the theme root as a ZIP and follow the upload workflow above.
Author a Reusable UIF Widget
A Press widget should be a small, reusable partial with explicit input data. It must not read arbitrary request values, query a database, or create its own publication authority.
- Define the widget purpose, allowed fields, empty state, and accessibility name.
- Add a partial such as
partials/widgets/callout.phpand pass it a bounded associative array from the layout. - Escape text with
htmlspecialchars, validate URLs before using them inhreforsrc, and reject unsupported markup. - Use UIF classes and
data-uif-*attributes only for progressive enhancement. The core message and action must remain usable before UIF starts. - Scope widget styles under a stable widget class. Do not override global element selectors or theme tokens inside the widget.
- If JavaScript inserts new icon hosts or components, initialize only the widget subtree and provide a cleanup path when the widget is removed.
- Test the widget with missing, short, long, and right-to-left text; keyboard navigation; 200 percent zoom; narrow screens; and light and dark tokens.
Example partial:
<?php
$title = htmlspecialchars((string)($widget['title'] ?? ''), ENT_QUOTES, 'UTF-8');
$copy = htmlspecialchars((string)($widget['copy'] ?? ''), ENT_QUOTES, 'UTF-8');
?>
<aside class="press-callout uif-card" aria-labelledby="press-callout-title">
<span data-uif-icon="info" aria-hidden="true"></span>
<h2 id="press-callout-title"><?php echo $title; ?></h2>
<p><?php echo $copy; ?></p>
</aside>See Batoi UIF and AIF for the Press runtime boundary, UIF Icons for icon initialization, and UIF Tokens and Theming for color-mode implementation.
Design Guidance
Contact Form Compatibility
Batoi Versatile remains 3.3.0 in the Press 4.0.10 package. The Press runtime improves generated CSP permissions for configured reCAPTCHA and protects contact-delivery error details. The built-in form uses v2 checkbox keys. Custom themes using v3 must supply server-side action/score verification and appropriate CSP; an engine upgrade does not automatically adapt custom form code or explicit policies. Test CAPTCHA and delivery on the deployed site after upgrading.
Media and Delivery in Press 3.2
Batoi Versatile stays at version 3.3.0 in the Press 3.2.0 package. The engine adds page-level hero preload, priority, responsive sizes, and optional lazy loading. Select a local hero already used in the page body; selection alone does not insert an image. Review above-the-fold placement and custom CSS before enabling these controls.
Optional uploads can create WebP/AVIF derivatives when GD supports the encoder. Originals are preserved; WebP copies provide responsive candidates, while AVIF copies require explicit selection. Video/audio preload defaults to none; autoplay is not enabled. Unsupported or unsafe body markup remains restricted.
PHP-served assets support bounded-memory streaming, conditional requests, HEAD, and single byte ranges. Only verified theme fingerprints receive immutable caching; cookie/authenticated requests remain private and non-stored. Direct Apache/CDN files follow hosting policies. See installation guidance for verification.
Use simple, predictable templates. Batoi Press is intended for compact public sites, not heavy application dashboards. Public themes may use the bundled UIF primitives, but they are not required to.