Removing Divs of form elements with profile2 fields I want to remove the extra divs that get added like in the following example (user-register-form):

&lt;div class="field-type-text field-name-field-phone-number field-widget-text-textfield form-wrapper" id="edit-profile-parent-field-phone-number"&gt;
  &lt;div id="profile-parent-field-phone-number-add-more-wrapper"&gt;
    &lt;div class="form-item form-type-textfield form-item-profile-parent-field-phone-number-und-0-value"&gt;

    &lt;label for="edit-profile-parent-field-phone-number-und-0-value"&gt;phone number &lt;span class="form-required" title="This field is required."&gt;*&lt;/span&gt;&lt;/label&gt;
    &lt;input class="text-full form-text required" type="text" id="edit-profile-parent-field-phone-number-und-0-value" name="profile_parent[field_phone_number][und][0][value]" value="" size="60" maxlength="255" /&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


I already did YOUR_THEME_form and YOUR_THEME_form_element in template.php to get rid of extra divs. But this only works for the standard fields of a form it seems.

I am using profile2 and profile2_regpath modules and it seems as if they add themselves extra divs for the fields that are specific to the profile fields. But I can't figure out how to overwrite this behavior.

Any help or hint appreciated.

And just in case it is already written somewhere: I used the search function and could only find the standard solution for normal fields. Nothing specific to profile2 module.

Oh and some details: I'm using Drupal 7. If anything else is needed, please tell me.

Thank you, best regards.
You can use a theme_field override to adjust the field markup.

e.g, for body field on article content type:


Copy theme_field to template.php
Rename function to THEMENAME_field__body__article($variables)
Clear theme registry cache
Modify theme function markup to suit.


Note, the theme function naming convention required the "field_" prefix on field names, e.g THEMENAME_field__field_example__article()