[Support request] Generateblocks Buttons (1.2 Beta 1)

Home Forums Support [Support request] Generateblocks Buttons (1.2 Beta 1)

Home Forums Support Generateblocks Buttons (1.2 Beta 1)

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1539185
    Alexander

    Hello Team!

    I am checking out the generateblocks 1.2 Beta1 and it would be great if the buttons would follow the settings set in customizer.

    I have the following code from another support topic in my functions.php but this only works for newly created buttons after the customizer settings have been set and doesn’t allow for after-the-fact changes.

    add_filter( 'generateblocks_defaults', function( $defaults ) {
        $color_settings = wp_parse_args(
            get_option( 'generate_settings', array() ),
            generate_get_color_defaults()
        );
    
        $defaults['button']['backgroundColor'] = $color_settings['form_button_background_color'];
        $defaults['button']['backgroundColorHover'] = $color_settings['form_button_background_color_hover'];
        $defaults['button']['textColor'] = $color_settings['form_button_text_color'];
        $defaults['button']['textColorHover'] = $color_settings['form_button_text_color_hover'];
        $defaults['button']['paddingTop'] = '10';
        $defaults['button']['paddingRight'] = '40';
        $defaults['button']['paddingBottom'] = '10';
        $defaults['button']['paddingLeft'] = '40';
        
        return $defaults;
    } );

    Love the new shape-dividers and overlays by the way!

    #1539231
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    That function will work for all newly added buttons.

    For example:

    1. Add that function.
    2. Add some buttons.
    3. Change the default in the function.
    4. Regenerate your CSS files.

    All of those newly-added buttons should reflect the changes you made in step 3.

    Glad you like 1.2! 🙂

    #1539241
    Alexander

    Hello Tom,

    thanks for your reply!

    I tried the regenerate CSS option but that does not seem to have the desired effect. Buttons stay at their old color. However, if I update/save the page, the styles are applied correctly.

    Is this the expected behavior?

    #1539485
    Tom
    Lead Developer
    Lead Developer

    You shouldn’t have to do that. Did you just load the edit page area and immediately save it to get it to work?

    #1539492
    Alexander

    Yes, that is exactly what I did.

    My complete steps are as follows:

    • Create a Generateblocks button on a page
    • Save page
    • Open Customizer
    • Go to Color – Buttons – change Background Hover Color
    • Save Customizer settings

    At this point, my coded buttons which have a class=”button” already adopted the new hover color.

    • Go to settings – General and Regenerate CSS file
    • Open incognito browser window to check for changes
    • GB Buttons are still at the old color
    • Edit page and immediately save
    • Visit page and see the new color applied

    Hope this helps!

    Edit: I am using GP 3.0.2 with Premium 1.12.2, Generateblocks is the 1.2 Beta 1

    #1540317
    Tom
    Lead Developer
    Lead Developer

    Interesting – I’ll dig into this a bit to see if it’s something we can improve.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.