- This topic has 5 replies, 2 voices, and was last updated 3 years, 5 months ago by Tom.
-
AuthorPosts
-
November 20, 2020 at 8:57 am #1539185Alexander
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!
November 20, 2020 at 9:38 am #1539231TomLead DeveloperLead DeveloperHi 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! 🙂
November 20, 2020 at 9:47 am #1539241AlexanderHello 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?
November 20, 2020 at 2:33 pm #1539485TomLead DeveloperLead DeveloperYou shouldn’t have to do that. Did you just load the edit page area and immediately save it to get it to work?
November 20, 2020 at 2:47 pm #1539492AlexanderYes, 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
November 21, 2020 at 10:42 am #1540317TomLead DeveloperLead DeveloperInteresting – I’ll dig into this a bit to see if it’s something we can improve.
-
AuthorPosts
- You must be logged in to reply to this topic.