-
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
Gallery Block: Missing 'Random Order' setting #9701
Comments
I've replicated this bug against |
Gallery settings were hidden in PR #1978, because Gutenberg didn't use them. I believe settings should now be made in post edit -screen after images are inserted to gallery: I wasn't able to replicate the front-end issue. I tested in desktop Chrome and Firefox with Gutenberg 3.9.0 (master branch) and twentyseventeen -theme. Could caption-gradient -issue be relating to Genesis framework? |
Aren't we missing the "order" settings? Like inverse order and such? |
Yes. It would be great to have back the |
Please bring back the random order setting. |
Here's what is in gallery settings when using the classic editor: And here's what is in gallery settings using the latest development version of the block editor: The only missing setting is Random Order. It's difficult to implement this in the gallery block right now, though, as it is a static block that does not use the We could look into making the gallery block dynamic. I'm not totally convinced, though, that supporting Random Order is worth the complexity and performance penalty that making this block dynamic would add. One way around some of that complexity would be to wait until the gallery block uses inner blocks. The For now, the workaround here is to use the shortcode block to insert a |
I'm happy using the classic mode till something can be figured out but it would be nice if this was in the block settings. Having random images in sites is cool. Especially design sites. |
after 2 years of developing versions, there is still missing that random option, or I am doing something wrong? |
It still hasn't been added but I hope it can be added one day. I have so many sites I'd like to add dynamic galleries to. We can do lots of different things with blocks now that can't easily be done in classic mode any more as well. |
I don't think the Gallery in the Classic editor did not randomize the order of the images displayed in the gallery in the editor when the Random Order option was checked, only on the published post/page. In the same spirit, one option would be to add the Random Order option setting back to the block and add in a conditional to shuffle the innerBlocks array before the foreach outputs them on the front-end. I think it is okay if the images are not in a random order in the editor if it avoids the complexity of making it a dynamic block. Perhaps changing the name of the option to "Randomize the order of the images in the published [posttype]" to make that clear would avoid user confusion. |
I need the random order for lots of sites I work on. It would be great if the gallery block could be made dynamic. The images only need to be randomized on the front end not in the editor as that makes work difficult. |
Whether we want to implement this functionality in Gutenberg or not, I think it can be achieved using function gutenberg_should_render_lightbox( $block ) {
if ( 'core/gallery' !== $block['blockName'] ) {
return $block;
}
if ( ! isset( $block['attrs']['className'] ) ) {
return $block;
}
if ( false === strpos( $block['attrs']['className'], 'random' ) ) {
return $block;
}
$inner_blocks = $block['innerBlocks'];
shuffle( $inner_blocks );
$block['innerBlocks'] = $inner_blocks;
return $block;
}
add_filter( 'render_block_data', 'gutenberg_should_render_lightbox', 15, 1 ); The gallery shortcode also has options such as |
Yes please. |
In the classic editor, when I go to set up a WordPress image gallery, there are "Gallery Settings" for "Link To", number of "Columns", "Random Order", "Size", and "Type" ("Thumbnail Grid", "Slideshow"). Those settings are missing in Gutenberg Version 3.7.0 when using the "Gallery" block.
Related: The captions on the Gutenberg "Gallery" block are styled so that the caption hangs oddly over the image. The images also can't be clicked on (possibly because there is no "Link To" option, as mentioned).
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expected the Gutenberg "Gallery" block to have "Gallery Settings" so that I'd have control over the following options: "Link To", number of "Columns", "Random Order", "Size", and "Type" ("Thumbnail Grid", "Slideshow").
Screenshots
Desktop (please complete the following information):
Additional Context
The text was updated successfully, but these errors were encountered: