theme_hook_suggestions based on empty field I'm trying to implement theme_hook_suggestions in preprocess node template based on the fact that a field (field_logo) is empty or not.

The template change is not working.

Can anyone help?

This is the code that I have so far:

function community_alpha_preprocess_node(&amp;$vars) {
  $node = $vars['node'];
  if(($node-&gt;type == 'advertorial') &amp;&amp; !$teaser &amp;&amp; $node_top){
    $advertorial_type = $node-&gt;field_logo['und'][0]['tid'];
    if(!empty($advertorial_type)){
      $vars['theme_hook_suggestions'] = 'node__advertorial';
    }else{
      $vars['theme_hook_suggestions'] = 'node__advertorial__alt';
    }
  }

}


Thanks.
You need to clear the cache after making changes in the template.php file.

For Drupal 7 version please run below command to clear the cache and check aftewards.

drush cc all

For Drupal 8 version please run below command to clear the cache and check afterwards.

drush cache-clear