Site logo

Archived topic

Apply all styles of GP "button" to GB-button

3 replies · Started by Chris on January 9, 2022

Viewing posts 1–4 of 4

Hi there!

As like to use the GB buttons with the styling configured in the GP theme. For taking over the colors, Tom already pointed out a solution here. I think it would be perfect if you could offer an out-of-the-box solution, as both products are highly integrated? I would love that :-D

For now, any chance to create a filter (or the like) to take not only the colors, but all style configurations which applied to class "button"? For me, the font styling is essential.

All the best
Chris

Hi Leo,

not exactly. There, Tom describes how to apply the colors. But what about the font styling?

Cheers
Chris

Hi Chris,

You can expand Tom's code here - https://generatepress.com/forums/topic/add-custom-css-selector-to-the-button-selector/#post-1322768 - by adding more $defaults options.

You can use this list as reference -
https://github.com/tomusborne/generateblocks/blob/74cfd3c7be6be26bd460b45463a58f1ef3b7a2c6/includes/defaults.php#L28-L419

And this list for the button specifically - https://github.com/tomusborne/generateblocks/blob/74cfd3c7be6be26bd460b45463a58f1ef3b7a2c6/includes/defaults.php#L184-L289

actual addition example to the filter would be:

$defaults['button']['fontFamily'] - if you want to set the font used.
$defaults['button']['fontSize'] - size on desktop
$defaults['button']['fontSizeTablet'] - size on tablet
$defaults['button']['fontSizeMobile'] - size on mobile

This archived topic is closed to new replies.