Hello,

I am trying to remove the title of just the front page and am unable to do so, I found this page

http://drupal.org/node/830624

but it refers to php pages I don't have in the new version

Files: 
CommentFileSizeAuthor
#6 site-b4.jpeg164.18 KBDeepika.chavan
#6 site-after.jpeg149.6 KBDeepika.chavan

Comments

Deepika.chavan’s picture

Hi,
While searching I got - http://mrtextminer.wordpress.com/2010/12/13/drupal-7-rc2-how-to-create-a...
Remove the following code from new page--front.tpl.php file.

<?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); ?>

Please clear cached data (here- admin/config/development/performance)
Hth!!

Rgrds,

Deepika Chavan.

calbert’s picture

I followed the steps,

copied page.tpl.php to --front.tpl.php

Commented out the above code, and flushed all cache and the front page still shows the title.

P.S. It was a pain in the ass vim'ing a -- file had to dig around for that ..

calbert’s picture

I just tried to change the footer, from DANLAND to CHRIS ROCKS just to test this --front.tpl.php and that didn't change as well .. so it would seem that this --front.tpl.php is not working

calbert’s picture

Any updates to this at all??

Deepika.chavan’s picture

Hi,
Have you copied the page.tpl.php file to "page--front.tpl.php", just wanted to confirm because you have written "--front.tp.php" in above post. I apologies if I have mistaken something. Because I tried the same thing on my local site and successfully removed the title from the home page. Please check the attachments. Do not comment the code just remove it from there.
HTH !!

Rgrds,

Deepika Chavan.

Deepika.chavan’s picture

StatusFileSize
new149.6 KB
new164.18 KB

Please check the attachments..

calbert’s picture

Yes,

You got me 1/2 way there, I changed the page * my mistake * from --front.tpl.php to page--front.tpl.php

and I noticed the footer changed to "testing Front page"..text I added in, I then removed the code

above code .. but the page I have promoted to front page still has it's title..

Deepika.chavan’s picture

Hi,
If you can see the footer changes only on front page, that means its picking up your file only for front page. But after removing the code(Title related code) It should not display the title on your front page. Have you clear the cached data? please don't mind just wanted to confirm.

Rgrds,

Deepika Chavan.

calbert’s picture

Yes, I've flushed all cached data many times, I re-checked to make sure the code above was removed. I can give you a code dump , maybe I missed something. You can see where I changed the danpro footer to TESTING 2 and that code shows up on the front page.

<?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; ?>

      </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; ?>
<div class="slideshow">
<img src="<?php print $base_path . $directory; ?>/images/slideshows/sea.jpg" width="950" height="355" alt="slideshow 1"/>
<img src="<?php print $base_path . $directory; ?>/images/slideshows/noon.jpg" width="950" height="355" alt="slideshow 2"/>
<img src="<?php print $base_path . $directory; ?>/images/slideshows/snow.jpg" width="950" height="355" alt="slideshow 3"/>
</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 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>Theme by <a href="http://www.danetsoft.com">TESTING 2</a> and <a href="http://www.danpros.com">Danang Probo Sayekti</a> inspired by <a href="http://www.maksimer.no">Maksimer</a></p></div>
</div>

Deepika.chavan’s picture

Hi,
Your code is right, I don't know why it is still showing the title on front page. Lets try something else.
1. Replace the following code in page--front.tpl.php file

<?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); ?>

by this code

<?php print render($title_prefix); ?>
      <?php if ($title): ?>
        <h1 class="title front-page-title" id="page-title">
   <?php print $title; ?>
        </h1>
     <?php endif; ?>
      <?php print render($title_suffix); ?>

Note: I have added class "front-page-title".
2. Remove the ';' from line of code ;stylesheets[all][] = local.css which is there in 'danland.info' file. Save the file.
3. Rename 'local_sample.css' file to local.css.
4. Add following css code in local.css file.

.front-page-title {
  display: none;
}

5. Clear the cached data.

Hope this helps !!

Rgrds,
Deepika chavan.

calbert’s picture

I've circled back around to this and it still won't remove it from the front page. I am unsure what to do. I tried all the code modes

biman’s picture

d7 (garland):
in page.tpl.php
Replace the following code:

<?php print render($title_prefix); ?>
<?php if ($title): ?>
  <h1<?php print $tabs ? ' class="with-tabs"' : '' ?>><?php print $title; ?></h1>
<?php endif; ?>
<?php print render($title_suffix); ?>

By:

<?php print render($title_prefix); ?>
<?php if ($title): ?>
  <h1<?php print $tabs ? ' class="with-tabs"' : '' ?>><?php if (!$is_front) { php print $title; } ?></h1>
<?php endif; ?>
<?php print render($title_suffix); ?>


d6 (cti_flex - zen based theme):
in node.tpl.php
Replace the following code:

<?php if (!$page): ?>
  <h2 class="title"><a href="<?php print $node_url; ?>"><?php { print $title; } ?>   </a></h2>
<?php endif; ?>

By:

<?php if (!$page): ?>
  <h2 class="title"><a href="<?php print $node_url; ?>"><?php if (!$is_front) { print $title; } ?>   </a></h2>
<?php endif; ?>
jpjanze’s picture

Thanks all and specifically biman, this was exactly what I needed.

Cheers!
Jon Paul

tanitani’s picture

Maybe you could use http://drupal.org/project/exclude_node_title. It takes care of it with as granularity as you want. Although in your case you solved it, however, you had to edit the the code directly, which you will have to maintain...

jayshapiro’s picture

Thank you tanitani - After lots of searching and far to much php/css code suggestions - this module is all I needed in the first place. THANKS!

Leeteq’s picture

Title:Remove title of Front page» How to remove node titles (only) on the Front page
Category:Task» Support request
Issue summary:View changes
Status:Active» Fixed

Introducing a whole new dependency on an extra module just to fix an issue with the front page, seems like overkill.

As an alternative to edit the main theme css file, if Danland was based on AdaptiveTheme (theme base), then it would be trivial to enable one of its features called "custom CSS", to add css overrides directly in the theme admin settings to get rid of the title ONLY on the front page, without having to edit/change the theme css file (which means you have to keep track of those change across each theme version update...).

Also without the side effect of adding extra, (in this case) unnecessary, modules and features such as letting you hide specific titles on each/specific node(s), which is strictly speaking not the need for solving the issue in this case.

Here is a code example that goes either in such a css override function, or in your main theme css file:

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

It turns off the display of any H1 titles that appears as page titles (only) on the front page.

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.