Simple way to fix that problem without installing modules or promote another page to frontpage.

Search in the page.tpl the line

<?php print $content; ?>

and replace with

<?php if (!drupal_is_front_page()) { ?>
<?php print $content; ?>
<?php } ?>

In this way I have my frontpage free from the default welcome message but with all the other thing.
The same way can be used to remove any - print $something - line from the frontpage.

Hope it can be useful! Bye!

Comments

ericpugh’s picture

This is exactly what I needed.

cheers

unghander’s picture

I needed that so badly. This is a very simple and usefull trick.

Oh yehar...

coryms’s picture

That worked liked a charm.

shopdogg’s picture

Nice, works also for drupal 6.x

edoizzi’s picture

Worked perfectly

XiaN Vizjereij’s picture

Thanks a lot for this easy fix :)

vincer’s picture

#first-time {
  display: none;
}
angelbreath’s picture

I m not to familiar with php . I have this in my page.tpl

<?php if ($page['content']) : ?><div class="content-middle"><?php print render ($page['content']); ?></div>
<?php endif; ?>
<?php if ($page['content_bottom']) : ?><div class="content-bottom"><?php print render ($page['content_bottom']); ?></div>
<?php endif; ?>

I m not sure how to change it . I would appriciate any help.
edited by silverwing - added code tag

marcoka’s picture

cleaner way to do it without functions, and using coding tpl standard

<?php if (!$is_front): ?>
               <div id="content" class="section region clear-block">
                <?php print $content; ?>
               </div>
           <?php endif; ?>
helike13’s picture

This method is not compatible with Drupal 7.

Is there an alternative method for this in Drupal 7?

jduguid’s picture

Did you try the CSS Way from xenowing? That worked for me in D7 - thanks xenowing!

kbrinner’s picture

If you're looking for how to do this in Drupal 7 and you come to this thread, check out Meepu's comment at http://drupal.org/node/1049290#comment-4074418 - works like a charm to remove both the 'Welcome to XXX' and 'No front page content has been created' messages on the home page.

helike13’s picture

<?php
// $Id: page.tpl.php,v 1.17.2.4 2010/11/19 14:42:44 danprobo Exp $
?>

<div <?php print danland_page_class($page['sidebar_first'], $page['sidebar_second']); ?>>
<div id="header">
<div id="header-wrapper">
<?php if ($logo): ?>
<div id="logo-wrapper">
<div class="logo">
<a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print $logo ?>" alt="<?php print t('Home') ?>" /></a>
</div>
</div><!-- end logo wrapper -->
<?php endif; ?>
<?php if ($site_name || $site_slogan) : ?>
<div id="branding-wrapper">
<?php if ($site_name) : ?>
<?php if ($is_front) : ?>
<h1 class="site-name"><a href="<?php print $base_path ?>" title="<?php print $site_name ?>"><?php print $site_name ?></a></h1>
<?php endif; ?>
<?php if (!$is_front) : ?>
<h2 class="site-name"><a href="<?php print $base_path ?>" title="<?php print $site_name ?>"><?php print $site_name ?></a></h2>
<?php endif; ?>
<?php endif; ?>
<?php if ($site_slogan) : ?>
<div class='site-slogan'><?php print $site_slogan; ?></div>
<?php endif; ?>
        </div><!-- end branding wrapper -->
<?php endif; ?>

<?php if ($page['search_box']): ?>
<div id="search-box">
<?php print render ($page['search_box']); ?>
</div><!-- /search-box -->
<?php endif; ?>

<?php if ($feed_icons): ?>
<div class="feed-wrapper">
<?php print $feed_icons; ?>
</div>
<?php endif; ?>

<?php if (!$is_admin): ?>
<div id="authorize">
            <ul><?php global $user; if ($user->uid != 0) { print '<li class="first">' .t('Logged in as '). '<a href="' .url('user/'.$user->uid). '">' .$user->name. '</a></li>'; print '<li><a href="' .url('user/logout'). '">' .t('Logout'). '</a></li>'; } else { print '<li class="first"><a href="' .url('user'). '">' .t('Login'). '</a></li>'; print '<li><a href="' .url('user/register'). '">' .t('Register'). '</a></li>'; } ?></ul>
</div>
<?php endif; ?>

      </div><!-- end header-wrapper -->
</div> <!-- /header -->
<div style="clear:both"></div>

<div id="menu">
<div id="rounded-menu-left"></div>
<?php if ($main_menu || $page['superfish_menu']): ?>
      <div id="<?php print $main_menu ? 'nav' : 'superfish' ; ?>">
        <?php
                        
if ($main_menu) {
                  print
theme('links__system_main_menu', array('links' => $main_menu)); 
                      }
                      elseif (!empty(
$page['superfish_menu'])) {
                        print
render ($page['superfish_menu']);
                      }
       
?>

      </div> <!-- end primary -->
    <?php endif; ?>
<div id="rounded-menu-right"></div>
</div> <!-- end menu -->
<div style="clear:both"></div>

<?php if($is_front): ?>
<div id="slideshow-wrapper">
<div class="slideshow-inner">
<div id="slideshow-preface">
<?php if ($page['preface']): ?>
          <div id="preface">
            <?php print render ($page['preface']); ?>
          </div><!-- end preface -->
<?php endif; ?>
</div>
<?php if ($page['highlighted']) : ?><div id="slideshow-bottom">
<div id="mission"><?php print render ($page['highlighted']); ?></div></div><?php endif; ?>

<object width="450" height"450">
<param name="movie" value="flash.swf">
<embed src="flash.swf" width="450" height="450">
</embed>
</object>

</div>
</div>
</div>
<?php endif; ?>

<?php if($page['preface_first'] || $page['preface_middle'] || $page['preface_last']) : ?>
    <div style="clear:both"></div>
    <div id="preface-wrapper" class="in<?php print (bool) $page['preface_first'] + (bool) $page['preface_middle'] + (bool) $page['preface_last']; ?>">
          <?php if($page['preface_first']) : ?>
          <div class="column A">
            <?php print render ($page['preface_first']); ?>
          </div>
          <?php endif; ?>
          <?php if($page['preface_middle']) : ?>
          <div class="column B">
            <?php print render ($page['preface_middle']); ?>
          </div>
          <?php endif; ?>
          <?php if($page['preface_last']) : ?>
          <div class="column C">
            <?php print render ($page['preface_last']); ?>
          </div>
          <?php endif; ?>
      <div style="clear:both"></div>
    </div>
    <?php endif; ?>

<div style="clear:both"></div>
<div id="wrapper">

    <?php if ($page['sidebar_first']): ?>
      <div id="sidebar-left" class="column sidebar"><div class="section">
        <?php print render($page['sidebar_first']); ?>
      </div></div> <!-- end sidebar-first -->
    <?php endif; ?>
<div id="content">
<a id="main-content"></a>
<?php if ($page['content_top']) : ?><div class="content-top"><?php print render ($page['content_top']); ?></div>
<?php endif; ?>
<?php if (!$is_front) print $breadcrumb; ?>
<?php if ($show_messages) { print $messages; }; ?>
      <?php print render($title_prefix); ?>
      <?php if ($title): ?>
        <h1 class="title" id="page-title">
         <?php print $title; ?>
        </h1>
     <?php endif; ?>
      <?php print render($title_suffix); ?>
      <?php if ($tabs): ?>
        <div class="tabs">
          <?php print render($tabs); ?>
        </div>
      <?php endif; ?>
      <?php print render($page['help']); ?>
      <?php if ($action_links): ?>
        <ul class="action-links">
          <?php print render($action_links); ?>
        </ul>
      <?php endif; ?>
      <?php if ($page['content']) : ?><div class="content-middle"><?php print render ($page['content']); ?></div>
<?php endif; ?>
<?php if ($page['content_bottom']) : ?><div class="content-bottom"><?php print render ($page['content_bottom']); ?></div>
<?php endif; ?>

</div> <!-- end content -->

    <?php if ($page['sidebar_second']): ?>
      <div id="sidebar-right" class="column sidebar"><div class="section">
        <?php print render($page['sidebar_second']); ?>
      </div></div> <!-- end sidebar-second -->
    <?php endif; ?>
<div style="clear:both"></div>
</div> <!-- end wrapper -->

<?php if($page['bottom_first'] || $page['bottom_middle'] || $page['bottom_last']) : ?>
    <div style="clear:both"></div>
    <div id="bottom-teaser" class="in<?php print (bool) $page['bottom_first'] + (bool) $page['bottom_middle'] + (bool) $page['bottom_last']; ?>">
          <?php if($page['bottom_first']) : ?>
          <div class="column A">
            <?php print render ($page['bottom_first']); ?>
          </div>
          <?php endif; ?>
          <?php if($page['bottom_middle']) : ?>
          <div class="column B">
            <?php print render ($page['bottom_middle']); ?>
          </div>
          <?php endif; ?>
          <?php if($page['bottom_last']) : ?>
          <div class="column C">
            <?php print render ($page['bottom_last']); ?>
          </div>
          <?php endif; ?>
      <div style="clear:both"></div>
    </div> <!-- end bottom first etc. -->
    <?php endif; ?>

<?php if($page['bottom_1'] || $page['bottom_2'] || $page['bottom_3'] || $page['bottom_4']) : ?>
    <div style="clear:both"></div><!-- Do not touch -->
    <div id="bottom-wrapper" class="in<?php print (bool) $page['bottom_1'] + (bool) $page['bottom_2'] + (bool) $page['bottom_3'] + (bool) $page['bottom_4']; ?>">
          <?php if($page['bottom_1']) : ?>
          <div class="column A">
            <?php print render ($page['bottom_1']); ?>
          </div>
          <?php endif; ?>
          <?php if($page['bottom_2']) : ?>
          <div class="column B">
            <?php print render ($page['bottom_2']); ?>
          </div>
          <?php endif; ?>
          <?php if($page['bottom_3']) : ?>
          <div class="column C">
            <?php print render ($page['bottom_3']); ?>
          </div>
          <?php endif; ?>
          <?php if($page['bottom_4']) : ?>
          <div class="column D">
            <?php print render ($page['bottom_4']); ?>
          </div>
          <?php endif; ?>
      <div style="clear:both"></div>
    </div><!-- end bottom -->
    <?php endif; ?>

<div style="clear:both"></div>
<div id="footer-wrapper">
<?php if($page['footer']): ?>
<div id="footer">
<?php print render ($page['footer']); ?>
</div>
<?php endif; ?>
<?php if($secondary_menu) : ?>
<div id="subnav-wrapper">
<?php print theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'subnav', 'class' => array('links', 'clearfix')))); ?>
</div>
<?php endif; ?>
</div> <!-- end footer wrapper -->

<div style="clear:both"></div>
<div id="notice"><p> <a href="http://www.example.com">example</a></p></div>
</div>

What should I modify to make that message vanish?

GNA27’s picture

Could anyone please help? How can we easily remove the entire "Welcome to" section of the front page in Drupal 7? There has to be a simple way to do this, but there seem to be numerous threads and support topics, none of which applies to Drupal 7 or none of which actually works.

mortendk’s picture

there is 2 ways to remove this.

1. Quick n Dirty css hack

#first-time{display:none} and its gone.

2. for the markup excentrics you can remove that with a little preprocess magick & unset the message
in template.php

<?php
function THEMENAME_preprocess_page(&$vars, $hook) {
    unset(
$vars['page']['content']['system_main']['default_message']);
}
?>

the last is that this is gonna be added to the mothership theme, to get this problem outta the way once n for all

yvesvanlaer’s picture

Thank you very much Morten, number 2 works like a charm.

aprilsguitar’s picture

Worked for me along with editing page--front to display no content.

casperovich’s picture

/**
*Implementation of hook_preprocess_page
*/
function vadim_preprocess_page(&$variables){
    if (isset($variables['page']['content']['system_main']['content']['default_message'])) {
        //Remove Default Message
        unset($variables['page']['content']['system_main']['content']['default_message']);
        //Remove Default Title
        drupal_set_title('');
    }       
}

That all.

fuquam’s picture

I tried that in my template.php file but the "Welcome ... No front page content has been created yet." message is still there. Did I put this in the wrong file?

Je K Ryan’s picture

Did you replace "vadim" with the name of your theme?

Hope that helps
JK

ryanoreilly’s picture

This removed both title and message from the front page,

<?php
function THEMENAME_preprocess_page(&$vars, $hook) {
    if (isset(
$vars['page']['content']['system_main']['default_message'])) {
           unset(
$vars['page']['content']['system_main']['default_message']);
          
drupal_set_title('');
    }
}
?>
mantorule’s picture

The above code is perfect, which removed both the message.

Thanks a lot ...

Joe3’s picture

Unfortunately this solution doesn't work for me. I'm using a custom subtheme of Omega and the name of my theme includes an underscore (ie: my_theme) and I have tried to write the function in different ways:

function my_theme_preprocess_page
function my-theme_preprocess_page
function mytheme_preprocess_page

The first seems the right one but I get only a blank page! Do I miss anything?

mheinke’s picture

in omega for D7 i found this

region-content.tpl.php

<?php if ($title): ?>
    <?php if ($title_hidden): ?><div class="element-invisible"><?php endif; ?>
    <h1 class="title" id="page-title"><?php print $title; ?></h1>
    <?php if ($title_hidden): ?></div><?php endif; ?>
    <?php endif; ?>

should be

<?php if ($title): ?>
    <?php if ($title_hidden || $is_front): ?><div class="element-invisible"><?php endif; ?>
    <h1 class="title" id="page-title"><?php print $title; ?></h1>
    <?php if ($title_hidden): ?></div><?php endif; ?>
    <?php endif; ?>

the only addition being hiding the title if page "is front"

***** FIX *****

this will only remove the title, and not section

<?php if ($title): ?>
    <?php if ($title_hidden): ?><div class="element-invisible"><?php endif; ?>
    <?php if (!$is_front): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?>
    <?php if ($title_hidden): ?></div><?php endif; ?>
    <?php endif; ?>

I think therefore I Drupal

eebanos’s picture

Create a subtheme, let's call it 'omsub', then on omsub/preprocess directory create a file:
preprocess-page.inc.
Inside the file:

<?php
function omsub_alpha_preprocess_page(&$vars) {
    if (isset(
$vars['page']['content']['content']['content']['system_main']['default_message'])) {
           unset(
$vars['page']['content']['content']['content']['system_main']['default_message']);
          
drupal_set_title('');
    }
}
?>

PS: Please note that the php closing tag should be removed.

Balamstudio’s picture

works for me

mark@redhorseinteractive.com’s picture

body.front h1#page-title{
display:none;
}

RedHorse