bricks_update_template_conditions
Overview
Updates the display conditions for a Bricks template. Conditions control where the template is shown on the site. Bricks uses a specificity scoring system to resolve conflicts when multiple templates match: specific IDs (score 10) beat frontpage (9), which beats archive/term (8), which beats postType (7), which beats « any » (2). This tool also allows updating template settings alongside conditions.
Key Features
When to Use
When resolving template condition conflicts between multiple templates of the same type
When adding exclusion conditions to prevent a template from showing on specific pages
When fine-tuning template specificity after initial creation
Understanding of Bricks condition scoring system helps resolve conflicts
When NOT to Use
When creating a new template with conditions — use bricks_create_template which accepts conditions at creation time
When deleting a template — use bricks_delete_template
Parameters
template_idnumberREQUIREDconditionsarrayREQUIREDsettingsobjectoptionalCode 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
Apply a footer to all pages except the homepage
{
"tool": "bricks_update_template_conditions",
"params": {
"template_id": 34,
"conditions": [
{ "main": "any" },
{ "main": "frontpage", "exclude": true }
]
}
}{
"success": true,
"conditions": [
{ "main": "any", "id": "a1b2c3" },
{ "main": "frontpage", "exclude": true, "id": "d4e5f6" }
],
"scores": [2, 9]
}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
Apply template only to specific post types
{
"tool": "bricks_update_template_conditions",
"params": {
"template_id": 40,
"conditions": [
{ "main": "postType", "postType": ["post", "mcp_tool"] }
]
}
}{
"success": true,
"conditions": [
{ "main": "postType", "postType": ["post", "mcp_tool"], "id": "g7h8i9" }
],
"scores": [7]
}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 ID auto-generation: Each condition needs a unique id field (6-character alphanumeric). The MCP plugin generates this automatically — you do not need to provide it.
Scoring reference: IDs = 10, frontpage = 9, archive/term = 8, postType = 7, any = 2. Higher score wins when multiple templates of the same type match a page.
Exclusion pattern: To apply a template everywhere except certain pages, use two conditions: [{main: "any"}, {main: "ids", ids: [42, 55], exclude: true}].