Navigation
CSS Classes
The structural CSS for the navigation block targets generic classnames across menu items of multiple types including those automatically generated by the Page List block. Here are some of the notable classnames and what they are used for:
A collection of blocks that allow visitors to get around your site.
Block Relationships
Allowed inner blocks:
– core/navigation-link
– core/search
– core/social-links
– core/page-list
– core/spacer
– core/home-link
– core/icon
– core/site-title
– core/site-logo
– core/navigation-submenu
– core/loginout
– core/buttons
Attributes
Defined via the attributes property in block.json.
| Attribute | Type | Default | Description |
|---|---|---|---|
ref |
number |
— | — |
textColor |
string |
— | — |
customTextColor |
string |
— | — |
rgbTextColor |
string |
— | — |
backgroundColor |
string |
— | — |
customBackgroundColor |
string |
— | — |
rgbBackgroundColor |
string |
— | — |
showSubmenuIcon |
boolean |
true |
— |
submenuVisibility |
string |
"hover" |
Enum: hover, click, always |
overlayMenu |
string |
"mobile" |
— |
overlay |
string |
— | — |
icon |
string |
"handle" |
— |
hasIcon |
boolean |
true |
— |
__unstableLocation |
string |
— | — |
overlayBackgroundColor |
string |
— | — |
customOverlayBackgroundColor |
string |
— | — |
overlayTextColor |
string |
— | — |
customOverlayTextColor |
string |
— | — |
maxNestingLevel |
number |
5 |
— |
templateLock |
string | boolean |
— | Enum: all, insert, contentOnly, false |
Supports
Defined via the supports property in block.json.
anchor:truealign:"wide","full"ariaLabel:truecontentRole:truehtml:falseinserter:truetypography:fontSize:truelineHeight:true
spacing:blockGap:trueunits:["px","em","rem","vh","vw"]
layout:allowSwitching:falseallowInheriting:falseallowVerticalAlignment:falseallowSizingOnChildren:truedefault:{"type":"flex"}
interactivity:truerenaming:false
Context
Defined via the usesContext and providesContext properties in block.json.
Provides context:
textColor→ attributetextColorcustomTextColor→ attributecustomTextColorbackgroundColor→ attributebackgroundColorcustomBackgroundColor→ attributecustomBackgroundColoroverlayTextColor→ attributeoverlayTextColorcustomOverlayTextColor→ attributecustomOverlayTextColoroverlayBackgroundColor→ attributeoverlayBackgroundColorcustomOverlayBackgroundColor→ attributecustomOverlayBackgroundColorfontSize→ attributefontSizecustomFontSize→ attributecustomFontSizeshowSubmenuIcon→ attributeshowSubmenuIconsubmenuVisibility→ attributesubmenuVisibilityopenSubmenusOnClick→ attributeopenSubmenusOnClickstyle→ attributestylemaxNestingLevel→ attributemaxNestingLevel
CSS Selectors
Defined via the selectors property in block.json.
Block Markup
This is a hybrid block. It saves static markup that the server may enhance during rendering.
<!-- wp:navigation -->
<!-- /wp:navigation -->
Source
- block.json (reference)
- Source directory — browse the
editandsavesource files,index.php, and more.
谢谢你的反馈!