Getting plain text field in drupal 7

I have a content type that includes two fields: First name (node ​​title) and Last name (text field) In node.tpl, I want to print the first and last name sequentially.

I use the following code for this, but it prints the first and last name on separate lines. Is it because the last name is wrapped in a div. Is there a way to get the source text of the name field?

<?php print $node->title . render($content['field_last_name']);?> 
+4
source share
1 answer

Try the following:

 <?php print $content['field_phone_number'][0]['#markup']; ?> 

Just replace the field "field_phone_number" with "field_last_name". You can do the same for the first name.

+8
source

All Articles