Skip to content

Gallery: Allow image sorting in editor - #80465

Closed
yashjawale wants to merge 5 commits into
WordPress:trunkfrom
yashjawale:feat/gallery-block-sorting-options-15370
Closed

yashjawale wants to merge 5 commits into
WordPress:trunkfrom
yashjawale:feat/gallery-block-sorting-options-15370

Conversation

@yashjawale

Copy link
Copy Markdown
Contributor

What?

Closes #15370

This PR lets users sort the images in gallery block through a toolbar button.
Without adding any additional attribute.

Why?

The gallery shortcode has a orderby parameter, this PR adds a similar functionality to the gallery block so the users don't have to manually sort the images.

How?

This PR adds an additional toolbar button for gallery block that sorts the images with the specified criteria. All sorting is done through JS in the editor itself. And doesn't add an additional attribute to the block.
By sorting in-place in the editor, the functionality for users to still manually modify the sorting remains unaffected.
And instead this method of sorting works more like a shortcut rather than a hard rule. So users can still manually override the order of images.

Testing Instructions

  1. Open a post or page
  2. Insert the gallery block
  3. Select a few images for the block
  4. Use the new toolbar button for sorting the images.
  5. Explore the sorting methods available

Screenshots or screencast

Screen.Recording.2026-07-20.at.1.12.41.PM.mov

Use of AI Tools

Assisted by DeepSeek V4 Flash through OpenCode
All changes reviewed & tested manually.

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Jul 20, 2026
@yashjawale
yashjawale marked this pull request as ready for review July 20, 2026 08:26
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @af1, @cjyabraham.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: af1, cjyabraham.

Co-authored-by: yashjawale <yashjawale@git.wordpress.org>
Co-authored-by: draganescu <andraganescu@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@andrewserong andrewserong added [Block] Gallery Affects the Gallery Block - used to display groups of images [Type] Enhancement A suggestion for improvement. labels Jul 21, 2026
@yashjawale

Copy link
Copy Markdown
Contributor Author

Implemented by #83438

@yashjawale yashjawale closed this Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Gallery Affects the Gallery Block - used to display groups of images [Package] Block library /packages/block-library [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User can sort images using an orderby setting in Gallery block

2 participants