Skip to content

Building a theme

The look of a site lives in a theme. A theme is a folder of templates, CSS, scripts and images. The Lightbolt frontend draws the site with it. A theme is code that runs next to other sites. So it goes through version control and a package, never through the admin.

A theme folder

<key>/
  theme.php        settings: parent, css (in order), strings per language, lists, sections
  templates/       layout.php, header.php, footer.php, default.php, <template key>.php, module-<name>.php
  blocks/          <block type>.php: how a block is drawn, when it differs from the parent's
  sections/        how the CMS's sections are drawn (hero, text, feature, media, banner)
  illustrations/   <key>.php: drawn pictures a section can show instead of an image
  shortcodes/      <name>.php: one component per shortcode
  assets/          CSS, images, fonts and scripts
  • The parent. Every template, block and file that a theme does not have comes from its parent. In the end, that is the base theme. So a theme only holds what is different. parent_css => false leaves out the CSS of the parent.
  • Which site gets it. You choose it in Lightbolt, under Theme → Theme version of the site, per environment. Choose a new version for staging first, and then for live.
  • Text for visitors comes from the CMS, or from strings per language in theme.php. Never write it in a template.
  • Nothing breaks the page. A template that fails is logged, and the page is drawn with default. An unknown block or shortcode shows nothing, and is logged once.

Going live

  1. Pack the folder as a theme package. The name of the folder is its key. Add THEME, with the version and the engine it needs, and MANIFEST.sha256.
  2. Upload it under Organisation → Themes, or from a pipeline.
  3. Choose it for staging, and check it. Then choose it for live. The frontend checks the hashes of the package before it uses it. It also empties the page cache of that environment.

In this section

Good to know

  • Build on the variables and classes that the CMS sends, such as colours, fonts, tokens and classes. Then a site owner can change the look in Theme, without a new theme version.
  • The own themes of an agency run only on a frontend that the agency owns.

Also called: theme development, child theme, template development, site design in code.

Last changed