Site logo

Archived topic

Using GP styles as default in GenerateBlocks

5 replies · Started by Sue on November 11, 2022

Viewing posts 1–6 of 6

I found this 2020 post from Tom re: how to "tell GenerateBlocks to use the GP styles as its default":
https://generatepress.com/forums/topic/add-custom-css-selector-to-the-button-selector/#post-1322768
His post contains some code that starts with "add_filter( 'generateblocks_defaults', function( $defaults ) {"

Where do I put this code? Do I use Elements, or a plugin like Code Snippets?
I am hoping that eventually the GenerateBlocks button styles will integrate with the GP customizer to make this easier!

Hi there,

that code is PHP, this article explains how to add it:

https://docs.generatepress.com/article/adding-php/

TLDR: Are you using a Child Theme?
If Yes, then you can add that code to your Child Themes functions.php
If No, then use the Code Snippets plugin and add it to a New Snippet.

I am not using a child theme, so I installed Code Snippets. I have set the button background to be a reddish color in the customizer, but it's still showing the blue background which appears to be the GenerateBlocks default for buttons in a group.

Were those buttons added after you added the code snippet ?

Ah, that was the trick! I removed that button group and put in a new one, and now they look fine. Thanks so much!!

Glad to hear that!!

This archived topic is closed to new replies.