Bricks 中文文档:bricks/posts/merge_query

标签TAGS: 

📄 原始资料  |  展开查看原始 JSON(bricks-posts-merge_query.json){ “name”: “bricks/posts/merge_query”, “kind”: “filter”, “url”: “https://academy.bricksbuilder.io/developer/hooks/filters/filter-bricks-posts-merge_query/”, “scraped_at”: “2026-08-29”, “hook_name”: “bricks/posts/merge_query”, “description…

📄 原始资料  |  展开查看原始 JSON(bricks-posts-merge_query.json)
{
  "name": "bricks/posts/merge_query",
  "kind": "filter",
  "url": "https://academy.bricksbuilder.io/developer/hooks/filters/filter-bricks-posts-merge_query/",
  "scraped_at": "2026-08-29",
  "hook_name": "bricks/posts/merge_query",
  "description": {
    "en": "Since Bricks 1.3.7 you’ll be able to decide if a certain element query should be merged with the WordPress main query, in the archive or search templates, using the following filter: The filter callback receives two arguments: This is triggered for all the Bricks elements containing one internal WP_Query query like the Posts and the Carousel element, or any other element where the Query Loop is enabled (Container, Slider, Accordion). Each element in Bricks has a unique ID. You may find the element ID when editing the element and looking into the Global CSS classes input. By default, it shows the element HTML ID (e.g. #bricks-element-wghgco ). For the purpose of this filter, we only need the last portion of the string, the six-character long element ID (e.g. wghgco ).",
    "zh": "从 Bricks 1.3.7 起,你可以使用以下筛选器决定某个元素查询是否应与 WordPress 主查询合并(在归档或搜索模板中):筛选器回调接收两个参数:这会针对所有包含内部 WP_Query 查询的 Bricks 元素触发,如 Posts 和 Carousel 元素,或任何启用了 Query Loop 的元素(Container、Slider、Accordion)。Bricks 中的每个元素都有一个唯一 ID。你可以在编辑元素时查看 Global CSS 类输入来找到元素 ID。默认情况下,它显示元素 HTML ID(例如 #bricks-element-wghgco)。对于此筛选器,我们只需要字符串的最后一部分,即六字符长的元素 ID(例如 wghgco)。"
  },
  "example_usage": null,
  "additional_sections": [
    {
      "heading": {
        "en": "How to find the element ID?",
        "zh": "如何查找元素 ID?"
      },
      "content": {
        "en": "Each element in Bricks has a unique ID. You may find the element ID when editing the element and looking into the Global CSS classes input. By default, it shows the element HTML ID (e.g.\n#bricks-element-wghgco\n). For the purpose of this filter, we only need the last portion of the string, the six-character long element ID (e.g.\nwghgco\n).\n",
        "zh": "Bricks 中的每个元素都有一个唯一 ID。你可以在编辑元素时查看 Global CSS 类输入来找到元素 ID。默认情况下,它显示元素 HTML ID(例如 #bricks-element-wghgco)。对于此筛选器,我们只需要字符串的最后一部分,即六字符长的元素 ID(例如 wghgco)。"
      }
    }
  ]
}

前言

从 Bricks 1.3.7 起,你可以使用以下筛选器决定某个元素查询是否应与 WordPress 主查询合并(在归档或搜索模板中):筛选器回调接收两个参数:这会针对所有包含内部 WP_Query 查询的 Bricks 元素触发,如 Posts 和 Carousel 元素,或任何启用了 Query Loop 的元素(Container、Slider、Accordion)。Bricks 中的每个元素都有一个唯一 ID。你可以在编辑元素时查看 Global CSS 类输入来找到元素 ID。默认情况下,它显示元素 HTML ID(例如 #bricks-element-wghgco)。对于此筛选器,我们只需要字符串的最后一部分,即六字符长的元素 ID(例如 wghgco)。

补充说明

更多细节可参考 官方文档