0
votes

I'm right now working on one of the drupal 7 project, which is basically based on Social networking like facebook.

Where we are including one of the module Heartbeat, in which we have done some customization and create one custom field from the Display Suite module. i have made this custom field and which is working good with Heartbeat module, but now we need required to display this custom field in all the other entity like node, comments, user profile etc.. I tried hard to do it but can't get success on. Can anyone give me hint how to use those custom display suite fields in node.tpl.php file ??

Thanks in advance.

Regards, Chandresh.

1
Damn. More social networking sites.Bojangles
not to worry...its just for couples only.. :)Chandresh M
Can you show us what you have tried already?KerrM
I have implemented module and also created one custom field from display suite, but i want to knw how to call this custom field into node.tpl.php page.??Chandresh M

1 Answers

0
votes

In your node.tpl you have to use following code, for example field name : field_header

 <!-- For Showing only custom field's Value Use below code -->
 <h2 class="title"><?php print $node->field_header['und']['0']['value'];?></h2>

 <!-- ========================= OR  ========================= -->

 <!-- For Showing custom field Use below code , which shows custom field's value and title-->
 <h2 class="title"><?php print render(field_view_field('node', $node, 'field_header'));  ?></h2>

 <!-- ========================= OR  ========================= -->

 <h2 class="title"><?php print render($content['field_header']); ?></h2>