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:

10 Comments

  1. 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.

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

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

  3. 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.

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

    Wow, very very handy, Chinmoy, Thanks!

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

    Awesome time-saver, thanks Chinmoy.

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

    Great tip Chimoy!

Leave a Comment





Newsletter

Get free weekly PRO Beaver Builder Tutorials

shares