Bricks 中文文档:bricks/archive_product/after

📄 原始资料  |  展开查看原始 JSON(bricks-archive_product-after.json){ “name”: “bricks/archive_product/after”, “kind”: “action”, “url”: “https://academy.bricksbuilder.io/developer/hooks/actions/bricks-archive_product-after/”, “scraped_at”: “2026-08-29”, “hook_name”: “bricks/archive_product/after”, “de…

📄 原始资料  |  展开查看原始 JSON(bricks-archive_product-after.json)
{
  "name": "bricks/archive_product/after",
  "kind": "action",
  "url": "https://academy.bricksbuilder.io/developer/hooks/actions/bricks-archive_product-after/",
  "scraped_at": "2026-08-29",
  "hook_name": "bricks/archive_product/after",
  "description": {
    "en": "Runs after the Bricks content is rendered on a WooCommerce product archive page when a Bricks template is used. This action is specific to WooCommerce archives rendered by Bricks.",
    "zh": "在使用 Bricks 模板的 WooCommerce 产品归档页面上,Bricks 内容渲染完成后触发。此动作专属于由 Bricks 渲染的 WooCommerce 归档页面。"
  },
  "parameters": [
    {
      "name": "bricks_data",
      "type": "array",
      "type_zh": null,
      "description": {
        "en": "The Bricks data for the template being rendered.",
        "zh": "正在渲染的模板的 Bricks 数据。"
      }
    },
    {
      "name": "post_id",
      "type": "int",
      "type_zh": null,
      "description": {
        "en": "The ID of the post/archive being rendered.",
        "zh": "正在渲染的文章/归档的 ID。"
      }
    }
  ],
  "example_usage": "add_action( 'bricks/archive_product/after', function( $bricks_data, $post_id ) {\n    // Output custom content after the product archive\n    echo '<div class=\"custom-archive-footer\">End of product list</div>';\n} );"
}

前言

在使用 Bricks 模板的 WooCommerce 产品归档页面上,Bricks 内容渲染完成后触发。此动作专属于由 Bricks 渲染的 WooCommerce 归档页面。

用法

将代码加入子主题的 functions.php

add_action( 'bricks/archive_product/after', function( $bricks_data, $post_id ) {
    // Output custom content after the product archive
    echo '';
} );

参数

  • $bricks_data (array):正在渲染的模板的 Bricks 数据。
  • $post_id (int):正在渲染的文章/归档的 ID。

示例代码

官方示例用法

add_action( 'bricks/archive_product/after', function( $bricks_data, $post_id ) {
    // Output custom content after the product archive
    echo '';
} );

根据条件短路返回原值

根据条件跳过或修改返回值:

add_filter( 'bricks/archive_product/after', function( $value, $bricks_data ) {
    if ( is_admin() ) { return $value; }
    // TODO: custom logic here
    return $value;
} );

补充说明

更多细节可参考 官方文档