Removing Gravity Form styles

Hi Everyone,

So, browsing through the forum, I came across a thread (Can't override gravity forms styles in Pro) that contained a snippet you can find below, that is supposed to remove the styles applied by the selected stack to Gravity Form. Sadly the code does not seem to be working for me. Is it outdated?

Also, I wanted to know if it is better to revive an old thread or simply create a new one?

Thanks!

add_action('init', 'no_x_gravity_form_css', 9999999);
function no_x_gravity_form_css () {
wp_dequeue_style( 'x-gravity-forms' );
}

Hello @kgpthemex

Thanks for writing to us.

The forms are styled to match the currently active theme, if you want to change the existing style, you need to add custom CSS code to do that. And if you want to completely remove our theme style, please add the following code into your child theme fuctions.php and replace this line of code

add_action('init', 'no_x_gravity_form_css', 9999999);

with this

add_action('x_enqueue_styles', 'no_x_gravity_form_css', 9999999);

Please have at the docs from Gravity form. https://docs.gravityforms.com/css-targeting-examples/

Hope it helps
Thanks

@prakash_s,

Thank you for getting back to me quickly. Yes my intention was to remove gravity form style completely. I did replace the line but I don’t think it made a difference. I’m going based on the “submit” button that every gravity form has. It seems to still be styled by the integrity theme.

Hello @kgpthemex,

The button has been using the global styles in X > Theme Options > Buttons. Would you mind providing us the URL of the page where we can find your gravity form so we can inspect it?

Thank you in advance.

Hi @ruenel,

I guess that makes sense. So dequeueing may not make a difference if Global styles are still being applied. Not sure what can be done. Please see the link in the notes.

Thank you!

Hi @kgpthemex,

The color of the button is the default color set in Theme Options, you can change that default values from Theme Options > Buttons.

If you don’t want to do that, you need to write the custom CSS code and add it into the Theme Options > CSS.

Hope it helps.
Thanks

@tristup,

Thank you for that. Yes I am aware on how to change these things. But I’m trying to figure out how to remove the style from Gravity form pages altogether. How do I know if that code provide is working? Nothing changed on my end before I added it and after I added it.

I had a similar scenario with Buddypress pages, and I needed to remove the theme styles applied to the Buddypress pages. I was given a code that very easily removed all of the styles on the Buddypress pages. I was hoping for a solution along those lines.

Thanks

Hello @kgpthemex,

The code to remove the Gravity form style is working as expected. The problem is that in the theme, the button has a general and global style. Without styling, it should look like this:
Screen Shot 2020-12-04 at 6.36.29 AM

Because of the global button style, the submit button of the gravity form is changed to look according to which stack you are using. At the moment, the button is styling with the following custom CSS:

.x-btn, .button, [type="submit"] {
    color: #ffffff;
    border-color: #ac1100;
    background-color: #ff2a13;
    margin-bottom: 0.25em;
    text-shadow: 0 0.075em 0.075em rgba(0,0,0,0.5);
    box-shadow: 0 0.25em 0 0 #a71000, 0 4px 9px rgba(0,0,0,0.75);
    border-radius: 0.25em;
}


.x-btn, .button, [type="submit"] {
    display: inline-block;
    position: relative;
    border: 1px solid #ac1100;
    border-radius: 0;
    padding: 0.563em 1.125em 0.813em;
    cursor: pointer;
    font-size: 16px;
    font-weight: inherit;
    line-height: 1.3;
    text-align: center;
    vertical-align: middle;
    color: #fff;
    background-color: #ff2a13;
    transition: all 0.15s linear;
}

Feel free to modify this code and add the modified code in Pro > Theme Options > CSS.

The given code above serves as an example. Be advised that custom coding is beyond the scope of our support. You will be the one to maintain any custom CSS that you may come up with and be added to the site.

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.