Displaying all fields of a custom content I have a page.tpl.php ; where I want to display inside a &lt;div&gt; in it the fields of a custom content I've created before :

1)The custom content is called "Slider"

2)It have a field I've added called image (Machine name :"field_image_slider")

I've tried this code but it didn't works :

    &lt;?php
        if (!empty($node)) :
           $fieldImage = field_get_items('node', $node, 'field_image_slider');
           print var_dump($node); //to check the fields 
           foreach ($node-&gt;field_image_slider['und'] as $item) {
              $val=$item['uri'];
              print '&lt;div class="item"&gt;&lt;figure&gt;&lt;img src="' .file_create_url($val). '" /&gt;&lt;/figure&gt;&lt;h3 class="orange"&gt;Hi&lt;/h3&gt;&lt;/div&gt;';
           } 
        endif;
    ?&gt;


I've spent 3 days figuring how to solve this problem , any help would be extremely appreciated .
I think you use wrong theme template. This way you need use node.tpl.php and  exactly is node--slider.tpl.php. You can see template suggestions. Or you don't want use node template i think better you can use hook_preprocess_page()

function YOURTHEME_preprocess_page(&amp;$vars) {
  if (isset($vars['node'])) {
    $node = $vars['node'];
    $field_images = field_get_items('node', $node, 'field_image_slider');
    //dpm($field_images);
    if (!empty($field_images)) {
      $output = '';
      foreach ($field_images as $key =&gt; $images) {
        $output .= '&lt;div class="item"&gt;&lt;figure&gt;&lt;img src="' .file_create_url($images['uri']). '" /&gt;&lt;/figure&gt;&lt;h3 class="orange"&gt;Hi&lt;/h3&gt;&lt;/div&gt;';
      }
      $vars['slider'] = $output;
    }
  }
}


and in page.tpl.php

&lt;?php if(isset($slider)): ?&gt;
  &lt;?php print $slider; ?&gt;
&lt;?php endif; ?&gt;