一个高级区块,允许根据不同的查询参数和视觉配置显示分类术语。

  • 名称: core/terms-query
  • 类别: 主题
  • API 版本: 3
  • 区块类型: 静态(保存在帖子内容中)
  • 关键词: terms, taxonomy, categories, tags, list

属性

通过 block.json 中的 attributes 属性定义。

属性类型默认值描述
termQueryobject{"perPage":10,"taxonomy":"category","order":"asc","orderBy":"name","include":[],"hideEmpty":true,"showNested":false,"inherit":false}—
tagNamestring"div"—

支持功能

通过 block.json 中的 supports 属性定义。

上下文

通过 block.json 中的 usesContext 和 providesContext 属性定义。

使用的上下文:

  • templateSlug

提供的上下文:

  • termQuery → 属性 termQuery

区块标记

这是一个 静态区块。标记直接保存在帖子内容中。

<!-- wp:terms-query -->
<div class="wp-block-terms-query"></div>
<!-- /wp:terms-query -->

来源