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)