-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement suitable fallback for Nav block on front end of site when no menu selected #36724
Merged
getdave
merged 10 commits into
trunk
from
try/page-list-as-nav-block-front-end-fallback
Nov 22, 2021
Merged
Implement suitable fallback for Nav block on front end of site when no menu selected #36724
getdave
merged 10 commits into
trunk
from
try/page-list-as-nav-block-front-end-fallback
Nov 22, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getdave
requested review from
adamziel,
tellthemachines,
talldan and
anton-vlasenko
November 22, 2021 11:02
getdave
commented
Nov 22, 2021
adamziel
reviewed
Nov 22, 2021
Some additional feedback here #36721 (comment) |
adamziel
approved these changes
Nov 22, 2021
As a followup I'm going to implement finding a Nav Menu. I have the code ready once this is merged. Update: it's ready at #36740 |
7 tasks
getdave
added
the
Backport to WP 6.7 Beta/RC
Pull request that needs to be backported to the WordPress major release that's currently in beta
label
Nov 23, 2021
7 tasks
noisysocks
removed
the
Backport to WP 6.7 Beta/RC
Pull request that needs to be backported to the WordPress major release that's currently in beta
label
Nov 28, 2021
noisysocks
pushed a commit
that referenced
this pull request
Nov 29, 2021
…no menu selected (#36724) * Use get_pages as block fallback * Simplify by using page list block * Output special class when rendering the fallback * Remove requirement for parsing the block * Fix linting * Limit max number of pages to 4 via context API * 2nd attempt to fix PHP linting * Revert debugging * Make attribute/context prop "unstable" * More linting
82 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In #36721 we learnt that the Nav block doesn't currently have a suitable fallback on the front end of the site when a menu is not selected.
This PR implements in the simplest way possible by falling back to rendering a
core/page-list
block with it's default attributes.As Nav is already set up to handle displaying this block the styles all work perfectly out of the box.
if we want to limit the number of items shown then we'll need to modifyUpdate: I added a commit which introduces acore/page-list
to have amaxPages
prop so we can control the number of items. We might be able to provide this via context. I suggest we do this in a separate PR.maxPages
attribute to the Nav block. We can then pass this to the Page List block via context to control the number of items that are displayed.Addresses part of #36721
How has this been tested?
Before testing use Fakerpress Plugin (or similar) to add a load of pages to your site. Some should be nested parent/child.
Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).