向导航中添加页面、链接或其他项目。
块关系
父级块(直接):
– core/navigation
允许的内部块:
– core/navigation-link
– core/navigation-submenu
– core/page-list
属性
通过 block.json 中的 attributes 属性定义。
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
label | string | — | 角色:content |
type | string | — | — |
description | string | — | — |
rel | string | — | — |
id | number | — | — |
opensInNewTab | boolean | false | — |
url | string | — | 角色:content |
title | string | — | — |
kind | string | — | — |
isTopLevelLink | boolean | — | — |
支持功能
通过 block.json 中的 supports 属性定义。
anchor:truereusable:falsehtml:falsetypography:fontSize:truelineHeight:true
renaming:falseinteractivity:clientNavigation:true
上下文
通过 block.json 中的 usesContext 和 providesContext 属性定义。
使用的上下文:
textColorcustomTextColorbackgroundColorcustomBackgroundColoroverlayTextColorcustomOverlayTextColoroverlayBackgroundColorcustomOverlayBackgroundColorfontSizecustomFontSizeshowSubmenuIconmaxNestingLevelstyle
CSS 选择器
通过 block.json 中的 selectors 属性定义。
- 状态:
- -current:
.wp-block-navigation .current-menu-item
- -current:
块标记
这是一个 混合块。它保存静态标记,服务器在渲染时可能会对其进行增强。
<!-- wp:navigation-link {"label":"WordPress","url":"https://wordpress.org/"} -->
<!-- /wp:navigation-link -->
来源
- block.json (参考)
- 源目录 — 浏览
edit和save源文件、index.php等。