function to insert classes into submit button

Forums › Forums › Search & Filter Pro › function to insert classes into submit button

Tagged: ,

Viewing 3 posts – 1 through 3 (of 3 total)
  • Anonymous
    #203125

    Is there, by any chance, a function to add classes to css buttons similar to the one below?

    add_filter( 'gform_submit_button', 'add_custom_css_classes', 10, 2 );
    function add_custom_css_classes( $button, $form ) {
        $dom = new DOMDocument();
        $dom->loadHTML( $button );
        $input = $dom->getElementsByTagName( 'input' )->item(0);
        $classes = $input->getAttribute( 'class' );
        $classes .= " edgtf-btn edgtf-btn-huge edgtf-btn-solid";
        $input->setAttribute( 'class', $classes );
        return $dom->saveHtml( $input );
    }

    I’m using several other plugins, I’ll be duplicating the same blocks of code several times when I can just use the same existing css classes. My stylesheet will get really bloated. 🙂

    Trevor
    #203175

    This is not possible, I am sorry. You would need to create some custom CSS and apply it to existing classes. This feature should arrive in V3, currently in development (some months away yet).

    Anonymous
    #203206

    No worries, Trevor. I found a workaround using .LESS. It will serious condense my stylesheet. I wonder why native wordpress doesn’t offer built in support for it.

Viewing 3 posts – 1 through 3 (of 3 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.