The idea
Kiln ships the loader as a site-wide setting, not as an element: it prints the overlay first thing in <body>,
with its own inline CSS, before the header template renders.
How to use it
- In Bricks > Kiln, turn on Site: page loader. Its settings open under the module's row.
- Choose a Style: Spinner, Progress bar at the top or Your logo, pulsing.
- Pick a Color and a Background with the color pickers. The defaults are
#222222and#ffffff. When your site has colors in Bricks' color palette, a list beside each picker offers them, so the loader follows the palette when you change it there.- Color in dark mode and Background in dark mode apply while Bricks' dark mode is on (Bricks sets it on the page, for example through the Toggle mode element). Leave them empty to keep the light-mode colors. A palette color that has a dark value in Bricks already switches on its own; these fields are for hex colors.
- If a palette color is later deleted in Bricks, the loader falls back to the default color (or, in dark mode, to the light-mode color) instead of turning transparent.
- Set Size, from 16 to 400 px. The default is 48.
- For the logo style, click Choose image under Logo and pick an image from your Media Library.
- Choose How it leaves: Fade out (the default), Slide up, Slide down, Grow and fade or Instantly, and how long Leaving takes (0 to 1500 ms, default 350).
- Set Show for at least (0 to 5000 ms, default 300) and Never longer than (1000 to 20000 ms, default 6000).
- Under Where, choose Every page (the default), The front page only, Only on the content chosen below or Everywhere except the content chosen below. For the last two, tick Content types (their single pages, their archives, and their category, tag and other term archives; Posts includes the blog page) and add Page or post IDs, separated by commas, up to 200. An ID can also be the blog page or the shop page. When the front page lists your latest posts, it counts as the blog page.
- Tick Only once per browser session to show the loader on a visitor's first page only. Tick Skip it for logged-in users to hide it from people who are signed in.
- Save your changes and open the site in a private window.
The loader removes itself when the page has fully loaded, after the minimum time. If the page is still loading when the maximum time runs out, it is removed anyway.
Where it appears in Bricks
Nowhere in the builder. The loader is not an element and has no control group. It only has the settings on the Bricks > Kiln page, and it never runs inside the builder or in embeds.
On the front end, Kiln prints the overlay first thing in <body>, so it paints before your stylesheet arrives.
What the styles do
- Spinner: a ring that turns. Size is its diameter.
- Progress bar at the top: a 4 px bar along the top edge. It fills on a timer set by Never longer than, and stops at 95% until the page has loaded. It does not measure the real load. Size has no effect on it.
- Your logo, pulsing: your image, pulsing between full and half opacity. Its maximum width is four times Size, or 60% of the window width if that is smaller. The image is output with empty alt text.
Limits
- Without JavaScript the loader never shows. The overlay is hidden until its script switches it on, so a script error or a blocked inline script cannot trap a visitor behind it.
- The logo style falls back to the spinner when the image is missing or is not an image. Saving an ID that is not an image clears the field.
- Visitors who prefer reduced motion get no animation, and the overlay is removed at once without waiting for the minimum time.
- The overlay is a screen-reader status with the text "Loading". It reports "busy" until it is removed.
- If you run a Content Security Policy, the inline script goes through WordPress' script tag function, so a CSP
plugin can add its nonce. The inline style needs
style-src 'unsafe-inline'or a hash. - The script carries the attributes
nowprocket,data-no-optimize,data-no-deferanddata-cfasync="false", which WP Rocket, LiteSpeed Cache and Cloudflare Rocket Loader read as "don't delay this script". Another optimizer that delays JavaScript, such as Perfmatters, may need the script excluded in its own settings. - The theme must call
wp_body_open, which Bricks does.
Settings
Style, Color, Background, Color and Background in dark mode, Size, Logo, How it leaves, Leaving takes, Show for at least, Never longer than, Where (with Content types and Page or post IDs), Only once per browser session and Skip it for logged-in users, all under the module in Bricks > Kiln. The module is off by default, because it changes what every visitor sees.
Requirements
Bricks 2.4 or newer.