📄 原始资料 | 展开查看原始 JSON(bricks_before_header.json){ “name”: “bricks_before_header”, “kind”: “action”, “url”: “https://academy.bricksbuilder.io/developer/hooks/actions/bricks-before_header/”, “scraped_at”: “2026-08-29”, “hook_name”: “bricks_before_header”, “description”: { “en”: “Runs before…
📄 原始资料 | 展开查看原始 JSON(bricks_before_header.json)
{
"name": "bricks_before_header",
"kind": "action",
"url": "https://academy.bricksbuilder.io/developer/hooks/actions/bricks-before_header/",
"scraped_at": "2026-08-29",
"hook_name": "bricks_before_header",
"description": {
"en": "Runs before Bricks renders the header template. Use it to output markup or run logic immediately before header rendering.",
"zh": "在 Bricks 渲染页头模板之前触发。用于在页头渲染之前立即输出标记或运行逻辑。"
},
"example_usage": "add_action( 'bricks_before_header', function() {\n echo '<div class=\"top-strip\">Free shipping this week</div>';\n} );"
}
前言
在 Bricks 渲染页头模板之前触发。用于在页头渲染之前立即输出标记或运行逻辑。
用法
将代码加入子主题的 functions.php:
add_action( 'bricks_before_header', function() {
echo 'Free shipping this week
';
} );
示例代码
官方示例用法
add_action( 'bricks_before_header', function() {
echo 'Free shipping this week
';
} );
补充说明
更多细节可参考 官方文档。