Archived topic
Change color of Buttons
10 replies · Started by Thomas on May 31, 2022
Hi guys,
I have Problems to change the color of a button.
I see in your docs https://docs.generatepress.com/article/adding-buttons/
that i can add buttons like this.
Where do i find the .button css file? Do i need to save an external css file?
When i go to the customizer i can change the global colors and as well the color of the buttons.
But when i change the color of the button it has no effect to the button itself.
I use the generatepress button not the wordpress button so it should word to change the color.
I dont know what i am doing wrong maybe you can help me with this matter?
thanks a lot for your kind help
Hi there,
can you share a link to a page where i can see a button that won't change color ?
Hi, David,
thanks for your quick answer.
Here is the link:
https://mighty.cl-i.net/
its the blue button
if you want i can give you access to wordpress to have a look.
thanks so much to care about my problems
Hi Thomas,
The blue button is a button block from GenerateBlocks, it has its own style set when you added it.
So just adding the buttonclass to the blue button won't change its style.
Are you trying to apply the theme button style to all the GB buttons?
Hi,
thanks for your kind answer.
I dont use the site library but i would like to make a theme button style for all the buttons on the website
i am using a child theme
In that case, this solution should work for you as well:
https://generatepress.com/forums/topic/global-button-colors/#post-2238306
Hi
thanks for your answer.
it did not work.
i put this code into functionts.php of the generate press child theme which is activated but the background color did not change.
add_filter( 'generateblocks_default_block_styles', function( $styles ) {
$styles['button']['backgroundColor'] = '#d6cdd3';
$styles['button']['textColor'] = '';
$styles['button']['backgroundColorHover'] = '';
$styles['button']['textColorHover'] = '';
$styles['button']['paddingTop'] = '';
$styles['button']['paddingRight'] = '';
$styles['button']['paddingBottom'] = '';
$styles['button']['paddingLeft'] = '';
return $styles;
} );
as well i added the class button on the page
----------------------
However I would like to refer to the regular way to setup a button
https://generatepress.com/forums/topic/buttons-2/
i added the css like described.
The only way i dont understand is where to insert this code:
maybe you can help me with that, then it would be easy to create buttons for me
thanks a lot.
Its working now, i only had to create a new button
However i would like to ask how to create a special button which is not available on the whole site, is it recommendable to setup with css like this?
https://generatepress.com/forums/topic/buttons-2/
And where to put the code:
a href="#">I'm Transparent</a
thanks so much for your kind help
However i would like to ask how to create a special button which is not available on the whole site, is it recommendable to setup with css like this?
The topic you linked is very old, at that time GB didn't exist.
No code will be required if you are using GB buttons. The PHP code removes its default style, but you can still customize its style by choose color/background color for this special button.
The link can be added by clicking the link icon:
https://www.screencast.com/t/NktR6tzVEp0E
Great you sent me the solution i was looking for.
thanks so much for your kind help
You are welcome :)