Skip to content

Instantly share code, notes, and snippets.

@justintadlock
Last active May 31, 2023 12:12
Show Gist options
  • Save justintadlock/6d394e1ee7a6b6bba55d7ebdf960e0bd to your computer and use it in GitHub Desktop.
Save justintadlock/6d394e1ee7a6b6bba55d7ebdf960e0bd to your computer and use it in GitHub Desktop.
Classic style for the WordPress Gallery block
<?php
// CSS adjustments may be necessary for the caption, depending on your theme.
add_action( 'init', function() {
register_block_style( 'core/gallery', [
'name' => 'classic',
'label' => __( 'Classic', 'theme-textdomain' ),
'inline_style' => '.wp-block-gallery.is-style-classic.has-nested-images {
align-items: flex-start;
}
.wp-block-gallery.is-style-classic figure.wp-block-image figcaption {
position: initial;
margin: 0;
padding: 0.5rem;
color: inherit;
background: unset;
}'
] );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment