I've been trying to print out CCK fields (Devel screenshot) in my custom node template using this code below which I found from a number of different sources (eg. src1, src2, src3) but with no result.

<?php print render($content['field_client_name']); ?>
<?php print render($content['field_bts_desc']); ?>

The code above seems to work for most people, if not all. I'm quite baffled as to why it doesn't work for me = /

Could it be something to do with Omega theme that I'm using as a base theme? I've also tried looking for Omega related issue with cck fields but still no result.

Please share your solutions with clear explanation, preferably like a step-by-step guide/explanation as I'm quite new to Drupal. Thank you!

  • When you do a print_r($content) somewhere on your node template, what exactly is the output of that? Commented Jun 18, 2012 at 17:37
  • @Boriana : this a snippet of what's printed out. The actual print is a whole lot more. About 3 times more than what's on the screenshot. It also seems like some of the print out is being repeated too. Commented Jun 19, 2012 at 2:44

3 Answers 3


I'd just start troubleshooting to see whether there's some part of the content that's problematic and breaking the output. Start by trying to print something out by going directly to the content.... doing statements like:

<?php print $content['field_bts_desc']['und'][0]['value']); ?> 

and see if that prints out or gives you problems. That way you can get to the content more directly and can see whether it's the content vs. something strange about the render function that's breaking things.

Do the same with other fields -- you know how to use print_r to see the arrays/objects' structure to find any trends.

Some follow-ups: 1. Does

 <?php print render($content['body']); ?>

give you any trouble?

  1. Also, do you have any log messages under 'admin/reports/dblog' after viewing a page that breaks with one of these print render statements that may give you some additional info?

(sorry I couldn't fit the above in a comment)

  • Thanks! I put in your first code but it didn't print out anything; html doesn't break though. I tried to understand/make use print_r result but I couldn't with my limited programming skill =/ After about a day of trying different things out, I decided to start from scratch and even started with a plain new theme. I could print out the field just fine!! Now that I managed to print out the fields, I encounter some other issues that I'm trying to solve. I'll create a new post for this new issue in a couple of hours if I can't figure it out, hope you could give some pointers, thanks :) Commented Jun 20, 2012 at 3:54

Go to you content type's manage display fields tab and check weather field is visible or not?

  • The fields are visible on Manage Display tab options. When I applied either code above that I mentioned, it will just break the page. Everything else below the code will not appear - breaks the html. When I moved it below <?php print $content; ?> then some of the content that disappeared would show but overall, it still break the page. Commented Jun 19, 2012 at 2:36

Still had no idea what went wrong. I decided to build my own theme from scratch and the usual way of printing the CCK fields (refer below) finally works for me as well. Thanks again!

<?php print render($content['field_client_name']); ?>
<?php print render($content['field_bts_desc']); ?> 

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.