Created
          August 25, 2024 00:13 
        
      - 
      
- 
        Save pixelstorm/b0777d676a9713f967602b43b9caabe5 to your computer and use it in GitHub Desktop. 
    Adds two custom CSS classes to the submit button
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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 .= " my-custom-class another-one"; | |
| $input->setAttribute( 'class', $classes ); | |
| return $dom->saveHtml( $input ); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment