向导航中添加页面、链接或其他项目。

  • 名称: core/navigation-link
  • 类别: 设计
  • API 版本: 3
  • 块类型: 混合(静态保存 + 服务器增强)

块关系

父级块(直接):
– core/navigation

允许的内部块:
– core/navigation-link
– core/navigation-submenu
– core/page-list

属性

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

属性类型默认值描述
labelstring—角色:content
typestring——
descriptionstring——
relstring——
idnumber——
opensInNewTabbooleanfalse—
urlstring—角色:content
titlestring——
kindstring——
isTopLevelLinkboolean——

支持功能

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

上下文

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

使用的上下文:

  • textColor
  • customTextColor
  • backgroundColor
  • customBackgroundColor
  • overlayTextColor
  • customOverlayTextColor
  • overlayBackgroundColor
  • customOverlayBackgroundColor
  • fontSize
  • customFontSize
  • showSubmenuIcon
  • maxNestingLevel
  • style

CSS 选择器

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

  • 状态:
    • -current:.wp-block-navigation .current-menu-item

块标记

这是一个 混合块。它保存静态标记,服务器在渲染时可能会对其进行增强。

<!-- wp:navigation-link {"label":"WordPress","url":"https://wordpress.org/"} -->
<!-- /wp:navigation-link -->

来源