Last active
May 31, 2023 12:12
-
-
Save justintadlock/6d394e1ee7a6b6bba55d7ebdf960e0bd to your computer and use it in GitHub Desktop.
Classic style for the WordPress Gallery block
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
<?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