GenerateBlocks defaults
-
Hello.
I am trying to set some defaults, for example for a button. I found this code hereadd_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; } );
But it’s not working.
Then I tried this filteradd_filter( 'generateblocks_default_button_attributes', function( $attributes ) {
return $attributes;
}Which works but not on initial inserting of the element in Gutebnerg, only after saving or opening block settings. Is it somehow possible to set correctly the defaults?
Thank you.
Radan
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.