Conditional on Header on a View Page?
You can user template_preprocess_views_view function to do it

function mymodule_preprocess_views_view(&amp;$variables) {
  if ($variables['view']-&gt;name == 'my_view') {
    if ($variables['view']-&gt;current_display == 'my_display' &amp;&amp; !empty($variables['rows'])) {
      $variables['header'] = '';
      $variables['footer'] = '';
    }
  }
}