Check if the page is the front page in a template
You should not declare a function in a Drupal template. Instead, you should just refer to that function:

&lt;?php
if (drupal_is_front_page()) {
    ?&gt;&lt;h1&gt;Test&lt;/h1&gt;&lt;?php
}
?&gt;