How do you add the default colors in Button module?

I was working on a site which have same color of button on lot of pages. By default button module have blank color under style->color section. So every time I was setting the color and it was very frustrated work for me. Therefore I can create a general template and add the button module there. But I did not want it. So I used some custom code and solved it.

For client site button’s color would be:

background color = #f59120
background hovercolor = #808080
text color = #fff
text hover color = #fff

So I opened my functions.php file and put this code:


  1. David Wang on February 27, 2020 at 3:39 pm

    Can you please update this tutorial to include default border settings?

  2. Thomas McMahon on February 16, 2018 at 2:36 am

    This doesn’t seem to be working anymore. Where is $type == “button-module” coming from?

    • Thomas McMahon on February 16, 2018 at 2:41 am

      Now it’s working. Odd. Still want to know the answer though on that type question. 🙂

      • WP Beaver World on February 16, 2018 at 9:20 am

        Module slug would be module file name with ‘-module’ suffix. e.g: Heading module’s file name is heading.php. So slug would be ‘heading-module’ for Heading module.

  3. John Natoli on January 12, 2018 at 1:47 pm

    I’ve been looking for exactly this tip — looking forward to trying it. Thanks!

  4. Jonathan Wilson on March 29, 2017 at 8:24 pm

    Wow! Great! Does this set the default color for all buttons in all modules? For example, forms, subscribe buttons, etc.?

    • WP Beaver World on March 29, 2017 at 9:33 pm

      Nope. It will only work for button module. But your idea is good. I liked it. I shall test it.

  5. Brenda Malone on March 27, 2017 at 5:52 pm

    Wow, very very handy, Chinmoy, Thanks!

  6. Athlone on March 24, 2017 at 2:56 pm

    Awesome time-saver, thanks Chinmoy.

  7. Roberto on March 23, 2017 at 10:23 pm

    Great tip Chimoy!

Leave a Comment

You must be logged in to post a comment.


Get free weekly PRO Beaver Builder Tutorials