Can I add text labels to input fields?

Yes. You can use any HTML markup in a form template. Try using label element like this:

<label>
  Your name [text* your-name]
</label>

You can also separate the label and form-tag. In this case, you need to add the for attribute to the label element. The for attribute value refers to the id option value in the associated form-tag:



[text* your-name id:namefield]

Pay attention when labeling checkboxes or radio buttons. A label element should not contain multiple form controls.

For example, you can’t do this (because this [checkbox] tag generates three checkboxes):

<label>
  Your country [checkbox your-country "China" "India" "San Marino"]
</label>

Instead, use the use_label_element option:

[checkbox your-country use_label_element "China" "India" "San Marino"]

The current Contact Form 7 plugin uses label elements in its default form template, but the usage of them is limited (we need to balance simplicity and accessibility in default configuration). If you want the default form template to use label elements more powerfully, I recommend an add-on plugin called Contact Form 7: Accessible Defaults.

See also

Just another contact form plugin for WordPress. Simple but flexible.

%d bloggers like this: