I have created text fields for first name and last name (which i need as separate fields so i can sort by last name when needed) but the default markup is so cumbersome! they each are nested in 3 divs, and all I want to do is display as a typical manner, ie. Firstname Lastname

How can I strip out the default markup for these 2 fields only? creating a field override template doesn't seem like a good idea, or is it?

2 Answers 2


Several ways to skin this cat. You can use a custom tpl.php as suggested, or, you can also explore some contrib modules such as display suite or fences.


Yes that's the best idea--that is exactly what template overrides are for. Figure out a tight override for it. Something like field--first-name.tpl.php. In there keep just the mark up you want. Probably something like:

<div class='firstname'><?php echo $variables['first-name']; ?></div>


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.