Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

display field before title node drupal 7

Tags:

field

drupal-7

I want to display the tag category of nodes before the title, the title field is unavailable in interface, is there a way to do that in node.tpl.php or page.tpl.php (I won't install another module like ds suite just for this purpose). PS: I want to do this everywhere node is displayed.

like image 469
Adel Avatar asked Sep 24 '26 23:09

Adel


1 Answers

You could:

  1. In your page.tpl.php where your title is echoed wrap the title in an if statement to not display $title if you are in a node page e.g
    if(arg(0)!='node'):
      if ($title ): 
        print $title;
      endif; 
    endif; 
//print title only if i am not on node pages
  1. and now you can print $node->title anywhere you like in your node.tpl.php

There other ways to do this in a custom module which sound more efficient, but if this is a single minor task, i guess editing your tpls is a good solution

like image 71
Pan Chrono Avatar answered Sep 28 '26 23:09

Pan Chrono



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!