Site logo

Archived topic

GB button block default border width, using GP alphas

3 replies · Started by Natalie on September 26, 2021

Viewing posts 1–4 of 4

I've set a default border size for the GB button block in my child theme functions.php

    add_filter( 'generateblocks_defaults', function( $defaults ) {
        $defaults['button']['borderSizeTop'] = '2px';
        $defaults['button']['borderSizeRight'] = '2px';
        $defaults['button']['borderSizeBottom'] = '2px';
        $defaults['button']['borderSizeLeft'] = '2px';
        return $defaults;
    } );

In the editor the bordersize is correct, but on the frontend the css has no border-width values set.
I tried regenerating the generateblocks css.

All other default values for button that I have tried work correctly, background color, text color, border radius etc, it's just the width that isn't working.
GP 3.1.0-alpha.2
GP premium: 2.1.0-alpha.4
GenerateBlocks: 1.4.0-alpha.2

Hi Natalie,

Very strange - any chance you can link us to a page where we can see the issue?

What happens if you add a border color?

oops - my fault

it should be

    add_filter( 'generateblocks_defaults', function( $defaults ) {
        $defaults['button']['borderSizeTop'] = '2';
        $defaults['button']['borderSizeRight'] = '2';
        $defaults['button']['borderSizeBottom'] = '2';
        $defaults['button']['borderSizeLeft'] = '2';
        return $defaults;
    } );

WITHOUT the 'px'

I copied the code from the person that posted here - it has the 'px' in it - hence my error
https://generatepress.com/forums/topic/integration-between-generatepress-customizer-and-generateblocks-global-styles/

Ah, I should have caught that too. Glad it's working now :)

This archived topic is closed to new replies.