Guides building and debugging Bricks header/footer templates, covering meta key routing, area lookup helpers, and automatic semantic landmark wrapping.
Ships in bricks. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Header, footer, and content elements live on the same bricks_template (or normal page) post: but in different postmeta keys. Get the key wrong and your write silently lands in a meta no renderer reads. Most "I edited the header but nothing changed" tickets come from this.
Defined in root functions.php:
| Constant | Default value | Holds |
|---|---|---|
BRICKS_DB_PAGE_HEADER | _bricks_page_header_2 | Header element tree |
BRICKS_DB_PAGE_CONTENT | _bricks_page_content_2 | Content / page-body element tree |
BRICKS_DB_PAGE_FOOTER | _bricks_page_footer_2 | Footer element tree |
Each meta value is a serialized PHP array of element objects. Same shape across all three: only the meta key differs.
A bricks_template post with _bricks_template_type = 'header' stores its tree in _bricks_page_header_2, not in _bricks_page_content_2. Reading _bricks_page_content_2 on that post returns '' and your render is blank.
Database::get_data() and get_bricks_data_key()Bricks core has two helpers that you should mirror in any custom code:
\Bricks\Database::get_bricks_data_key( $area ); // 'header' | 'footer' | 'content'
\Bricks\Database::get_data( $post_id, $area ); // returns the element tree
$area is 'header', 'footer', or 'content'. Pass the wrong area and you'll silently read/write the wrong tree.
The Bricks Save_Pipeline also accepts area: Save_Pipeline::execute( $post_id, $elements, $area ).
The Bricks MCP element-write abilities (add-element, update-element, remove-element, set-page-elements) infer the area from the post's template type:
bricks_template + _bricks_template_type = 'header' -> area 'header' -> reads/writes _bricks_page_header_2.bricks_template + _bricks_template_type = 'footer' -> area 'footer' -> _bricks_page_footer_2.'content' -> _bricks_page_content_2.You don't have to specify the area in the call. Just pass postId and the element id: the routing is automatic.
<header> / <footer> wrapper is automatic: don't double upWhen Bricks renders a header or footer template on the frontend, it wraps the entire element tree in a semantic landmark for you:
<header bricks-data>...your tree...</header> (includes/frontend.php:1626).<footer bricks-data>...your tree...</footer> (includes/frontend.php:1719).So the root element of a header template should not carry tag: "header" (or tag: "custom" + customTag: "header"). Same for footer. Doing so produces nested <header><header>...</header></header>: invalid HTML5 landmarks, accessibility regression, and triggers the "duplicate <header>" rule in axe / WAVE.
The right defaults inside a header/footer template:
section element for the top-level layout (it renders as <section> by default, which is fine inside a <header> landmark).block / container element with tag: "div" if you don't want a section landmark either.nav is a valid tag on a container/section, AND it's correct inside a <header>: different landmarks, no nesting conflict.A common safe shape for a header template:
section (tag: section, default)
`-- block (tag: div)
|-- logo image
`-- nav-nested
`-- block (tag: ul, _hidden._cssClasses: brx-nav-nested-items)
`-- menu items
Nav Nested needs that direct nestable items wrapper; on Bricks 2.4.2+ read its
nestableChildren from bricks/get-element-schema before creating the tree.
Keep any mobile toggle siblings from the native structure. If the site uses an
ordinary nav-menu element or a custom Block with tag: nav, preserve that
existing navigation model.
Nothing here sets tag: header. The wrapping <header> comes from the renderer.
Same rule for footers. The footer template's root should be a section or block (not tag: footer). Bricks adds the <footer> wrapper when it renders.
Bricks supplies the landmark wrapper for header and footer templates. Use ordinary layout elements inside that wrapper.
Note: the tag control's built-in option set on container/section/block does not include header or footer: those are reachable only via tag: "custom" + customTag: "...". If you find yourself reaching for the custom escape hatch to set header, that's the cue you're double-wrapping.
These all silently no-op or corrupt the tree:
_bricks_page_content_2 on a header template (wrong key: no renderer reads it).wp_slash(): element values containing \\ get unslashed by update_post_meta and the next read returns broken data.Save_Pipeline::execute: bypasses revision creation, queryId reindex, and filter-index rebuild. Visible until next save, then mangled.Bricks finds the active header/footer template via find_template_id( 'header' | 'footer' ): same scoring as content templates (see bricks-templates-conditions skill). The highest-scoring matching template wins.
If no header template matches, no header is rendered. The <body> opens straight into the page content. Check that a matching header template exists.
Best fallback: one header + one footer template, each with conditions: [{ "main": "any" }] (NOT entireWebsite). Then add specific overrides per section.
list-templates filtered by type: header -> find the active header template id.get-page-structure (postId: <header-id>) -> see the existing tree (Bricks routes correctly).add-element (postId: <header-id>, parentId: <nav-container-id>, element: { name: "image", settings: { image: { url: "..." } } }) -> write goes to the header meta automatically.get-page-elements (postId: <header-id>): confirm the new element id appears in the tree.It already is, by default. Footer template with { "main": "any" } is global; no per-page overrides needed unless you create them. If a specific page has its own footer, you (or the user) created a more-specific condition somewhere.
Order of investigation:
update-element returns the postId: confirm it matches the visible header/footer.bricks-templates-conditions skill).regenerate-css-files ability or "Regenerate CSS files" in admin).regenerate-css-files again).Builder runs an unsaved version in memory; frontend reads the persisted meta. If save failed (lock, save endpoint error, hook error), the builder shows the new state but the frontend serves the old one.
Verify by reading the meta directly:
get-page-elements (postId)
If the meta is the old version, the save didn't land. Look for: locked-by-other-user errors, save endpoint errors, or hook errors in the PHP error log.
Use footerReveal with set-template-settings, then check the result in a browser at each breakpoint: the effect turns itself off when the footer is taller than the viewport.
For pages (page post type), Bricks first looks for a matching header template. If none matches, the page renders without a header. Pages don't have their own per-page header by default: the header is always template-driven.
If you need a page-specific header: create a header template scoped to that page ({ "main": "ids", "ids": [42] }).
_bricks_page_content_2 on a header or footer template post: silently lost.area arg to MCP element abilities expecting it to override the auto-routing: the abilities derive area from template type.wp_update_post content fields: Bricks doesn't render from post_content.wp_slash() an array of elements before update_post_meta if you're writing in custom PHP. In Bricks 2.4.5 and later, the ability Save_Pipeline slashes string values before saving (includes/abilities/save-pipeline.php::slash_strings); Bricks 2.4.4 and older did not.list-templates (type: header|footer): find existing templates of each type.get-template, create-template, delete-template: template CRUD; use set-template-settings or set-template-conditions for settings and conditions. The template type controls which Bricks data area the renderer reads.set-template-conditions: control which pages a header/footer applies to.add-element / update-element / remove-element / set-page-elements: area-aware element writes.regenerate-css-files: force a CSS rebuild when style changes don't propagate.bricks-templates-conditions: full scoring rules for which header/footer wins on a given page.bricks-nestable-elements: Nav Nested + Offcanvas live almost exclusively in headers.bricks-mega-menus: Bricks-native Nav Nested mega menus and WordPress menu-backed mega menu setup.bricks-quality-gate: the verify-after-write loop that catches silent header/footer regressions.What SKILL.md sets; muted values are Claude Code's defaults
/bricks:bricks-headers-footersfrom bricks
npx claudepluginhub codeerhq/bricks-skills --plugin bricks46 skills in this plugin
/bricks-agent-repositoryHandle complex existing-site Bricks edits through advertised repository/workspace workflows when focused abilities cannot express the change./bricks-ai-tabDiagnose Bricks AI connection setup, ability toggles, dispatcher availability and disabled actions. Use for connection/availability problems./bricks-audit-design-systemAudit Bricks classes, variables, palettes and components, or carry out requested cleanup. Report-only audits do not authorize fixes./bricks-breakpointsRead or change Bricks responsive breakpoint definitions. Use for breakpoint configuration, not ordinary element styling at an existing breakpoint./bricks-browser-verifyInspect a Bricks page in a browser, compare it with a design or baseline, or verify a completed change. Inspection requests remain read-only./bricks-child-theme-patternsSet up or debug a Bricks child theme, including asset loading and extension registration. Use for theme-level PHP/files, not ordinary Builder edits.Other plugins' skills for the same job