How to add a CCK field to custom template file? I am working on a Drupal 7 site, and I am setting up a template that will be used with the Print module when PDFs are created using that module. The PDFs will draw from pages that list specifications of products, and the PDF itself will act as the printed spec sheet.

I want to completely customize the output of the PDF so that I can choose where each and every field will be placed. Unfortunately, the PDF creation is currently not respecting all of the layout specifics on the website page, so I have decided to customize the print.tpl.php file (part of the Print module) to enact those specific layout elements.

The part I am stuck on is... how do I call in the various individual fields/fieldsets from the content item and have them show up on the template file for printing? For instance, the content type is "Shirts" and one of the fields in question is "Color" ("field_shirtcolor")... how can I access that field/print that field in my custom tpl file?

Thanks!
Add to your print.tpl.php code like next for printing certain field:

&lt;?php print render(field_view_field('node', $print['node'], 'field_shirtcolor')); ?&gt;


If field is multiple:

&lt;?php 
  $field = field_get_items('node', $print['node'], 'field_shirtcolor');
  $delta = 0;  // Put here index of multiple field or use `foreach ($field as $val) {}` for scanning multifield values.
  print render(field_view_value('node', $print['node'], 'field_shirtcolor', $field[$delta]));
?&gt;


If field is image:

$image = field_get_items('node', $print['node'], 'field_image');
print render(field_view_value('node', $print['node'], 'field_image', $image[0], array(
  'type' =&gt; 'image',
  'settings' =&gt; array(
    'image_style' =&gt; 'STYLENAME',
    'image_link' =&gt; '',
  ),
)));


p.s. Drupal 6 CCK in Drupal 7, 8 called as just Fields.