📄 原始资料 | 展开查看原始 JSON(bricks-query-init_loop_index.json){ “name”: “bricks/query/init_loop_index”, “kind”: “filter”, “url”: “https://academy.bricksbuilder.io/developer/hooks/filters/filter-bricks-query-init_loop_index/”, “scraped_at”: “2026-08-29”, “hook_name”: “bricks/query/init_loop_inde…
📄 原始资料 | 展开查看原始 JSON(bricks-query-init_loop_index.json)
{
"name": "bricks/query/init_loop_index",
"kind": "filter",
"url": "https://academy.bricksbuilder.io/developer/hooks/filters/filter-bricks-query-init_loop_index/",
"scraped_at": "2026-08-29",
"hook_name": "bricks/query/init_loop_index",
"description": {
"en": "The bricks/query/init_loop_index filter, available @since 1.11 , allows you to modify the initial loop index when using various query types in Bricks Builder. This filter is especially useful in cases such as infinite scroll or paginated queries, where setting the correct loop index is crucial for displaying content seamlessly across multiple pages especially when using dynamic backgound images or colors. Without this hook, the generated dynamic CSS might be applied on the incorrect element when performing infinite scroll or paginate actions. This filter is particularly useful when creating a custom query type using the bricks/setup/control_options hook. You can implement your own logic for handling pagination and adjust the initial loop index accordingly.",
"zh": "bricks/query/init_loop_index 筛选器(自 @since 1.11 起可用)允许你在 Bricks Builder 中使用各种查询类型时修改初始循环索引。此筛选器在无限滚动或分页查询等场景中特别有用,其中设置正确的循环索引对于跨多个页面无缝显示内容至关重要,尤其是在使用动态背景图像或颜色时。如果没有此钩子,在执行无限滚动或分页操作时,生成的动态 CSS 可能应用于错误的元素。当使用 bricks/setup/control_options 钩子创建自定义查询类型时,此筛选器尤为有用。你可以实现自己的分页处理逻辑并相应地调整初始循环索引。"
},
"example_usage": null
}
前言
bricks/query/init_loop_index 筛选器(自 @since 1.11 起可用)允许你在 Bricks Builder 中使用各种查询类型时修改初始循环索引。此筛选器在无限滚动或分页查询等场景中特别有用,其中设置正确的循环索引对于跨多个页面无缝显示内容至关重要,尤其是在使用动态背景图像或颜色时。如果没有此钩子,在执行无限滚动或分页操作时,生成的动态 CSS 可能应用于错误的元素。当使用 bricks/setup/control_options 钩子创建自定义查询类型时,此筛选器尤为有用。你可以实现自己的分页处理逻辑并相应地调整初始循环索引。
补充说明
更多细节可参考 官方文档。