Tutorial: Using Site Layout
Site Layout is where you build a visual, dynamic template for single posts, pages, archives, 404, or search results — using the same Page Builder canvas you already use for regular Pages, but with widgets that pull their content from whatever post WordPress is currently displaying instead of content you type in manually.
For the full architecture reference, see Site Layout. This tutorial covers the day-to-day workflow: creating an entry, adding dynamic widgets, and setting its display condition.
Creating a Site Layout Entry
- Go to WordPress Admin → Sanil Builder → Site Layouts.
- Click Add New Site Layout. A modal opens.
- Give it a descriptive Name (e.g. "Default Archive Layout") — this is only for your own reference in the admin list; it is never shown to site visitors.
- Pick Applies to — Single Post, Page, Archive, 404 Page, or Search Results.
- If a Condition section appears (it does for every type except 404/Search), pick how narrow this row should be — see Setting the Display Condition below. You can also leave it as "All" for now and narrow it later.
- Click Create Site Layout. You're taken straight into the full-screen Page Builder editor for the new row.
Adding Dynamic Widgets
Alongside every normal Page Builder widget (Heading, Paragraph, Image, Posts, …), the widget picker includes dynamic widgets that resolve against whatever post WordPress's current loop/query has in scope, rather than content you type in:
| Widget | Resolves to |
|---|---|
| Post Title | get_the_title() of the current post |
| Archive Title | get_the_archive_title() — the category/tag/date/author/post-type label |
| Featured Image | The current post's featured image, via the shared sanilwb_get_featured_image() helper |
| Post Content | The current post's full content, run through the same filter chain the_content() uses |
| Excerpt | The current post's excerpt, with an optional word-count override |
None of these have a text field to fill in — there is nothing to type, because the content is never fixed. Drop one in, style it (tag, color, typography, alignment — see Page Builder → Typography Fields), and save.
Why widgets look empty while you're editing
While you're building a Site Layout entry, the canvas previews widgets against the entry itself — not against a real post — because there is no "real post" yet; you're authoring a template that will apply to many different posts later. Excerpt/Post Content/Featured Image will show a dashed placeholder box instead of a blank one while you edit. This is expected — it only appears in the admin editor, never on the live site. See Site Layout → Editing against an entry's own ambient context for why.
For an archive-type entry, open Canvas Settings in the topbar and use the Preview Term picker to preview widgets against a real category/tag instead of the placeholder.
Setting the Display Condition
Every Site Layout row applies to a broad type (Single Post, Page, Archive, 404, Search) plus, for the first three, an optional condition narrowing which real content it matches. You can set or change this either in the creation modal or later, in the editor's Canvas Settings panel (topbar gear icon).
The available Condition options depend on the type you picked:
| Applies To | Condition Options |
|---|---|
| Single Post | All, Specific Post Type, Entire Taxonomy, Specific Term, Specific Post |
| Page | All, Specific Post |
| Archive | All, Specific Post Type, Entire Taxonomy, Specific Term |
| 404 / Search | (no condition — always applies) |
Only one row wins per real request. If two active rows of the same type could both match (e.g. one "All" row and one "Specific Term" row, both type Archive), the more specific one wins — a row targeting an exact term or post always beats a broader one. If two rows are equally specific, whichever was created first wins.
To stop a row from being active, either change its type/condition so it no longer matches anything you care about, or trash it from the list screen — a trashed or deleted row is treated exactly like "never existed" for matching purposes.
Verifying It Worked
Visit a real post/page/archive/404/search-results URL matching the type and condition you set. You should see your Site Layout entry's design, with dynamic widgets showing that specific page's real title/content/excerpt/image — not the placeholder box you saw while editing.
If nothing changed on the frontend:
- Confirm the row isn't in Trash — trashed rows are treated as "not assigned" and the theme's default template renders instead.
- Confirm the Applies to type and Condition actually match the URL you're testing — check the list screen's Applies To / Condition columns.
- For archive-type entries, confirm each item in the loop shows different data per card (not all cards repeating the first post) — if every card looks identical, something is preventing the loop from advancing; check for PHP errors in the debug log.
Common Mistakes
A dynamic widget shows nothing on the live frontend
This can be legitimate: a 404 page has no post at all, so Post Title/Excerpt/etc. correctly render nothing there. On a real single/page/archive item, an empty Excerpt or Post Content usually means that specific post genuinely has no content/excerpt set — not a bug in the widget.
Two rows both target "Archive" and I'm not sure which one is winning
Check each row's Condition column on the list screen — the more specific one wins on any request both could match, per Setting the Display Condition above. If they're tied at the same specificity, the older row (lower id, created first) wins.
I deleted/trashed the active entry and the site broke
It shouldn't — a trashed or deleted row is treated the same as "nothing matches," and the active theme's own normal template renders for that request instead, completely untouched by the plugin. There's always a fallback for these five types. Header and Footer are also Site Layout types now, but they have no such fallback — if you trash the only active Header (or Footer) row, nothing renders in that region at all until another one is made active. See Site Layout → Header and Footer as Site Layout Types.
My Header/Footer row exists and is active, but it's still not showing
Check the row's own Show header / Show footer toggle in the editor's Canvas Settings panel first — it's a real, persisted per-item switch (not just an editor preview), so it's easy to have turned it off on one specific page or row without remembering. It only controls this Site Layout's own Header/Footer content — it never brings back the active theme's own header/footer, since Page Builder content always renders in "Canvas" mode (its own bare document, bypassing the theme's chrome entirely). See Site Layout → Include Header and Footer Toggle.