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:
- Navigate to GP’s Customizer.
- Click on Typography.
- Access the Typography Manager.
- Click the
Add typography
button. - Choose “Custom Selector” as the Target element.
- Enter
.gb-button
in the custom CSS selector field. - 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.