bricks_create_template
Overview
Creates a new Bricks template (header, footer, section, archive, popup, etc.) with optional initial content and display conditions. Templates are WordPress custom post types with type metadata that determine where they are applied. This is the primary tool for building site-wide headers, footers, archive layouts, and reusable sections.
Key Features
When to Use
When creating archive templates for custom post types or WooCommerce
When building reusable section templates that can be applied across multiple pages
When setting up error (404) or search results templates
For WooCommerce templates, WooCommerce plugin must be active
Color palette and global classes should exist for consistent template styling
When NOT to Use
When creating a popup — use bricks_create_popup which has trigger/animation settings
When you need to update an existing template — use bricks_update_template_content or bricks_update_template_conditions
Parameters
titlestringREQUIREDtypestringREQUIREDheader, footer, archive, search, error, section, popup, wc_archive, wc_product, wc_cart, wc_cart_empty, wc_form_checkout, wc_form_pay, wc_thankyou, wc_order_receipt, wc_account_dashboard, wc_account_orders, wc_account_view_order, wc_account_downloads, wc_account_addresses, wc_account_form_edit_address, wc_account_form_edit_account, wc_account_form_login, wc_account_form_lost_password, wc_account_form_lost_password_confirmation, wc_account_reset_passwordstatusstringoptionalpublish Values: publish, draftcontentobjectoptionalconditionsarrayoptionalsettingsobjectoptionalCode Examples
Warning: Undefined array key "example_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 10
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018
Create a sticky header template for the entire site
{
"tool": "bricks_create_template",
"params": {
"title": "Main Header",
"type": "header",
"status": "publish",
"conditions": [{ "main": "any" }],
"settings": {
"headerSticky": true,
"headerStickyOnScroll": true
},
"content": {
"type": "section",
"children": [{
"type": "container",
"settings": { "_display": "flex", "_justifyContent": "space-between", "_alignItems": "center" },
"children": [
{ "type": "logo", "settings": { "height": "40px" } },
{ "type": "nav-menu", "settings": { "menu": 5 } },
{ "type": "button", "settings": { "text": "Contact" }, "globalClasses": ["btn-primary"] }
]
}]
}
}
}{
"template_id": 36,
"title": "Main Header",
"type": "header",
"conditions": [{ "main": "any", "id": "a1b2c3" }],
"element_count": 5
}Common Mistakes
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Tips & Warnings
Condition scoring: Bricks resolves template conflicts using specificity scores. From highest to lowest: specific IDs (10) > frontpage (9) > archive/term (8) > postType (7) > any (2). Use bricks_update_template_conditions to fine-tune conditions after creation.
Critical bug note: Each condition must have an id field (6-char random alphanumeric). The MCP plugin auto-generates this, so you do not need to provide it manually.
Content area mapping: The content area is auto-detected from template type — header templates write to _bricks_page_header_2, footer templates to _bricks_page_footer_2, and all others to _bricks_page_content_2.