For $vars['id'] == 1 render field Y instead of field X So on my Blog listing page, the first listing is "featured" meaning it spans two columns rather than one, I've achieved most of my styling changes by adding CSS class feature to $vars['id'] == 1 for the blog page.

However, the image for  first teaser is a different proportions and therefore uses custom field header image rather than custom field thumbnail image. In the following:

function innovista_preprocess_node(&amp;$vars) {
  if ($vars['id'] == 1 &amp;&amp; arg(0) == 'blog') {
    $vars['classes_array'][] = 'feature';

    //do stuff to switch field here?

  }
}


I want to add a command to switch render of $content['field_blog_thumbnail_image'] with render of  $content['field_blog_header_image']. How can I go about this?

Thanks for your time!
Ok so the way I achieved this was to go into my node--content_type.tpl.php file and do a simple check for 'feature' in the classes string. Printing the correct image depending on the outcome of the check.

So first in admin I set both header and thumbnail images to display when showing as a teaser. But then in the template file I began by hiding them:

hide($content['field_blog_thumbnail_image']);
hide($content['field_blog_header_image']);


This means that they don't render with print render($content);

In the place where I wanted to display the image I then used simple logic to check the $classes variable to see if the string contained 'feature'. If it did I render the header image, if not, the thumbnail image:

if(strpos($classes,'feature')==true){
    print render($content['field_blog_header_image']);
} else{
    print render($content['field_blog_thumbnail_image']);
}