User login

Remove the main content title from the front page of the site

Sometimes we have a lot of blocks from views and such on our front page, going where the content usually goes, so we don't want our front page to be the /node stream. We could make it a View page but if all the other Views are blocks, it seems wrong to play favorites (and may be annoying for theming or changing things later). Plus, it's nice to have that one node for the little bit of (easily editable) static content.

Here's the function for "example" theme's template.php to remove the page title:

<?php
function example_preprocess_page(&$vars, $hook) {
 
// Remove title (ie a node title on a node page) when on the front page
 
if ($vars['is_front']) {
   
$vars['title'] = '';
  }
}
?>

Another option to allow all of our blocks with various views to be first on a page, and then a static node below them, is to make the ordering of regions in the content area more sensible.

Here is my variation of the content column in Zen's page.tpl.php:

      <div id="content" class="column"><div class="section">

        <?php if ($mission): ?>
          <div id="mission"><?php print $mission; ?></div>
        <?php endif; ?>

        <?php print $breadcrumb; ?>
        <?php print $messages; ?>
        <?php print $help; ?>
        <?php print $content_top; ?>

        <?php if ($title): ?>
          <h1 class="title"><?php print $title; ?></h1>
        <?php endif; ?>
        <?php if ($tabs): ?>
          <div class="tabs"><?php print $tabs; ?></div>
        <?php endif; ?>

        <div id="content-area">
          <?php print $content; ?>
        </div>

        <?php print $content_bottom; ?>

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

      </div></div> <!-- /.section, /#content -->

Searched words: 
remove title front page

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.