Sync GB button style with GeneratePress theme

Many GenerateBlocks users also use the GeneratePress theme along with GP Premium features. Some of these users wish to align GenerateBlocks buttons with the style of the GP theme’s button.

Sync with GP button color settings and define button paddings

By using this filter, you have the capability to achieve this synchronization. Additionally, you have the flexibility to specify custom padding values for your GenerateBlocks buttons as needed.

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'] = '20';
    $defaults['button']['paddingBottom'] = '10';
    $defaults['button']['paddingLeft'] = '20';

    return $defaults;
} );

Define typography in GP’s typography system

Furthermore, if you wish to establish distinct typography for GenerateBlocks (GB) buttons within GeneratePress’ typography system, follow these steps:

  1. Navigate to GP’s Customizer.
  2. Click on Typography.
  3. Access the Typography Manager.
  4. Click the Add typography button.
  5. Choose “Custom Selector” as the Target element.
  6. Enter .gb-button in the custom CSS selector field.
  7. Begin defining your customized typography styles for GB buttons.

By following these instructions, you can seamlessly tailor typography settings to suit your preferences for GB buttons within the GeneratePress theme.