-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add menu_order sorting option to Query Loop block #68781
Open
kasparsd
wants to merge
27
commits into
WordPress:trunk
Choose a base branch
from
kasparsd:42710-add-menu-order-option
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
f0c3039
Add support for menu order
kasparsd 11fca2e
Add the menu order option
kasparsd 681186c
Two more copy-paste location
kasparsd 27dd5a1
Match the order
kasparsd a50362f
Update labels per discussion
kasparsd 6def53a
Helper for resolving order by options for a post type
kasparsd 0ed2ac0
Add the option type
kasparsd 066e3e3
Pass in the options
kasparsd f40d2b6
Restrict the values to only known values
kasparsd 777debf
Keep the order
kasparsd ba52675
Define the type for just the option
kasparsd 016c83e
Document the updated fields
kasparsd 568fd9d
Update the examples
kasparsd f6af1ec
Reference the type
kasparsd 27a3c60
This is really required for the drop-down component, keep it simple here
kasparsd ef44e18
Merge remote-tracking branch 'origin/trunk' into 42710-add-menu-order…
kasparsd a6c408a
Add back the default options to prevent breaking changes
kasparsd 49affb3
Use memo to avoid rebuilding the list of options
kasparsd 1becd19
Add back the defaults to avoid breaking changes
kasparsd 27c04ea
Keep the default as prefix to match the rest of coding style
kasparsd 924364c
Rely on the default orderby options for now
kasparsd 2cca836
Remove for now
kasparsd d7e34aa
Resolve the options via the helper instead
kasparsd ca99bbd
Latest posts list only posts which don’t support custom menu order fo…
kasparsd 3947b6a
Add our changelog
kasparsd 7cc05e8
Formatting
kasparsd 4c6a316
Document the change
kasparsd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ const QUERY_DEFAULTS = { | |
|
||
const MyQueryControls = () => { | ||
const [ query, setQuery ] = useState( QUERY_DEFAULTS ); | ||
const { category, categories, maxItems, minItems, numberOfItems, order, orderBy } = query; | ||
const { category, categories, maxItems, minItems, numberOfItems, order, orderBy } = query; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Mamaduka I got confused by the use of |
||
|
||
const updateQuery = ( newQuery ) => { | ||
setQuery( { ...query, ...newQuery } ); | ||
|
@@ -213,7 +213,14 @@ The order in which to retrieve posts. | |
- Required: No | ||
- Platform: Web | ||
|
||
#### `orderBy`: `'date' | 'title'` | ||
#### `orderBy`: `'date' | 'title' | 'menu_order'` | ||
|
||
The meta key by which to order posts. | ||
|
||
- Required: No | ||
- Platform: Web | ||
|
||
#### `orderByOptions`: `OrderByOption[]` | ||
|
||
The meta key by which to order posts. | ||
|
||
|
@@ -246,4 +253,4 @@ The selected category for the `categoriesList` prop. | |
Start opting into the larger default height that will become the default size in a future version. | ||
|
||
- Required: No | ||
- Default: `false` | ||
- Default: `false` |
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're keeping the defaults as fallback to prevent breaking changes.