-
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
Gallery Block: Add random order setting #57477
Conversation
Size Change: +60 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
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.
Nice work @t-hamano 👍
This tests really well for me. I left one minor suggestion as an inline comment below but I'll leave that up to you.
✅ Pasted shortcode is successfully transformed to a gallery with random order
✅ Transforming images to galleries and vice versa still works
✅ Manually creating a randomly order gallery works
✅ A randomly ordered gallery does have the order of its images changed on each load
✅ Fixture tests all pass
LGTM 🚢
Co-authored-by: Aaron Robertshaw <[email protected]>
Thank you. It will be great to have the random setting back again. |
🙌 |
Thank you a lot for this feature. Many issues out there request the order by random in one block or another... Could you please take one second to transport/migrate the solution approved here to solve its brother issue? -> #40481 Please please❤️.. |
Fixes #9701
What?
This PR adds a new "Random order" setting to the Gallery block.
Why?
The gallery shortcode has many options. The Gallery block substantially covers many of the shortcode options, as we can reorder the images inside. It also automatically inherits some options when pasting a shortcode. However, only random order cannot be achieved unless the additional setting is added.
How?
In addition to adding settings, I've made it so that the random option is inherited when a shortcode is converted to a block. In the future, we may support other values for
orderby
(menu_order
,title
, etc.) andorder
options.Testing Instructions
[gallery ids="1,2,3,4" orderby="rand"]
Screenshots or screencast
449a58a83fd997d26d9072567b082f92.mp4