PDD #6 - How to remove the sentence "No front page content has been created yet"

Drupal

This is the episode number 6 of Practical Drupal Development. This time I'm going to show you how to remove the sentence "No front page content has been created yet".

Issue to be solved

How many times have you read the sentence No front page content has been created yet after a fresh installation of Drupal? If you needed to get rid of it, how would you do it?

No front page content

In Drupal 7 there are some functions that allow you to do any processing to those PHP variables used by template files. In this example, I'm going to use template_preprocess_page in order to get rid of this sentence.

template.php is the right file to be edited in order for you to be able to declare template preprocess functions.

<?php
/**
 * This preprocess function is the primary preprocessor for theme hook page.
 */
function your_theme_name_preprocess_page(&$variables) {

  $front_page = drupal_is_front_page();

  if ($front_page) {

    $variables['title'] = '';

    unset($variables['page']['content']['content']['content']['system_main']['default_message']);

  }

}
?>

If you want to go further on template preprocess functions, you can read the Drupal API and the article number one of this series.