-
JulieRayCreative
I have two problems.
1) The customizer setting for button color seem to be applying to the default WP button (The stacked icon) and not the GB button (The single button icon.)I can edit the colors in a global style, but client adds posts and they just add whatever button in, and I want the colors to at least GO with the site, and not the bright blue that fills in default.
I’ve cleared cache and checked css. Is this expected behavior?
And 2) I can’t get the buttons to stop underlining on hover
I’ve turned off underlines globally and added this css to keep them for the content
.entry-content a:hover {
text-decoration: underline;
}
but am still getting underlined button text.
Can you help?
Thanks! -
Alvind
Hi there,
For issue #1 — yes, that’s expected. The GB Button block has its own default styles and doesn’t inherit color settings from the Customizer. However, you can override those defaults by using this snippet:
add_filter( 'generateblocks_default_button_attributes', function( $attributes ) { $attributes['styles'] = [ 'display' => 'inline-flex', 'alignItems' => 'center', 'backgroundColor' => 'var(--contrast)', 'color' => '#ffffff', 'paddingTop' => '1rem', 'paddingRight' => '2rem', 'paddingBottom' => '1rem', 'paddingLeft' => '2rem', 'textDecoration' => 'none', '&:is(:hover, :focus)' => [ 'backgroundColor' => 'var(--contrast-2)', 'color' => '#ffffff', ], ]; return $attributes; } );Adding PHP: https://docs.generatepress.com/article/adding-php/
For the button underline issue, try replacing your CSS with this:
.entry-content a:not(.wp-block-button__link, a.gb-text):hover { text-decoration: underline; }Alternatively, for the GB Button block, you can disable the underline directly in the block settings under Typography.
-
JulieRayCreative
Thank you! This worked!
-
Alvind
Glad to hear that!
- You must be logged in to reply to this topic.