Skip to content
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

Global Styles: Re-add styles that were removed, for classic themes #44334

Merged
merged 4 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/compat/wordpress-6.1/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,12 @@ function gutenberg_enqueue_global_styles() {
add_action( 'wp_footer', 'gutenberg_enqueue_global_styles', 1 );
add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_stored_styles' );
add_action( 'wp_footer', 'gutenberg_enqueue_stored_styles', 1 );

function gutenberg_enqueue_classic_theme_styles() {
if ( ! wp_is_block_theme() ) {
wp_register_style( 'classic-theme-styles', gutenberg_url( 'build/block-library/classic.css' ), array(), true );
wp_enqueue_style( 'classic-theme-styles' );
}
}
add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_classic_theme_styles' );
add_action( 'admin_enqueue_scripts', 'gutenberg_enqueue_classic_theme_styles' );
getdave marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 15 additions & 0 deletions packages/block-library/src/classic.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// These rules are needed for backwards compatibility.
.wp-block-button__link {
color: $white;
background-color: #32373c;
border-radius: 9999px; // 100% causes an oval, but any explicit but really high value retains the pill shape.

// This needs a low specificity so it won't override the rules from the button element if defined in theme.json.
box-shadow: none;
text-decoration: none;

// The extra 2px are added to size solids the same as the outline versions.
padding: calc(0.667em + 2px) calc(1.333em + 2px);

font-size: 1.125em;
}