• Does anybody have an idea, how I can add the field class (i.e. half-width) to the wrapping span element?

    What I get:
    <span class="wpcf7-form-control-wrap firstname"><input type="text" name="firstname" value="" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required half-width" aria-required="true" aria-invalid="false" placeholder="Vorname"></span>

    What I would like to get (class “half-width” in span element):
    <span class="wpcf7-form-control-wrap firstname half-width"><input type="text" name="firstname" value="" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required half-width" aria-required="true" aria-invalid="false" placeholder="Vorname"></span>

    Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Sprul66

    (@sprul66)

    Bump

    This drives me nuts.

    Yes me too. I would really like to know! There must be a hook for this right?

    We can do this with jQuery of course, but I would like a PHP way so that the form shows up this way, preferably with a filter.

    I took a look and I don’t believe that there is. This class is synthesized in a number of different files, but each time it looks like this:

    
    	$html = sprintf(
    		'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
    		sanitize_html_class( $tag->name ), $atts, $validation_error );
    

    I don’t see a way of adding classes without changing the code in the plugin. Could the field type please be added? Ideally in the way the OP requested, wpcf7-text, wpcf7-textarea, wpcf7-url, etc. In the meantime I will write a javascript patch for it and share it here.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add field class to wrapper span’ is closed to new replies.