Hi all

I am having an absolute nightmare trying to do something that should seemingly be simple and straight forward.

http://i27.tinypic.com/zlq9vn.jpg

Above is a link to a picture. I want to remove the $title link from appearing on my home page, in order to simply create a splash page which will then link to various parts of the site.

Now.

1. I have attempted to rename the default path to home, and upload page-front.tpl.php to my themes folder (wabi theme)

2. I then tried renaming page-front.tpl.php to page-home.tpl.php and uploading to my themes folder.

3. I tried editing node.tpl.php and removing the title link, but this removes it from all pages, not just the page I want as my default home page.

I am now pulling my hair out and I'm completely frustrated that something so simple is proving to be ridiculously annoying.

In simple terms, (as if you were speaking to a child) please could someone put me out of my misery and explain what needs to be done.

Thank you so much in advance.

Comments

nevets’s picture

Is your front page the default (normally a list of nodes) or have you set it to point to a single node?

McJustin-1’s picture

I have tried both. Leaving my default front page as "node". Then changing my default front page as "home" and obviously making those changes to the actual page I'm using in URL settings. Then I tried pointing to a specific node "node/2" for example. Nada.

nevets’s picture

In node.tpl.php you will find something like (this is from garland, other themes may differ on how they print the title)

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

<?php if ($page == 0 && !$is_front): ?>
I changed the 'if' like this

so the titles no longer print on the front page.

You can also use $is_front in page.tpl.php. $is_front is true if viewing the front page, otherwise false.

fiockthis’s picture

Awesome! You rock!

I added the && !$is_front to node.tpl.php in the Fresh Media theme, and the titles are now gone on my frontpage.

Thank you so much, I've been looking forever for this solution.

-Anti-’s picture

1)
Do you have the 'views' module installed?
You'll need it anyway further down the line (Views and CCK are 'must-have' modules for most drupal websites).
You could probably create a view of the node which didn't display the title (I'm about 80% sure).

2)
Also, the frontpage module might help: http://drupal.org/project/front
You could have separate css for your splash page, and therefore hide the title only on that page:

.node-title {display: none}

It might have other handy features you could use, too.

3)
Sorry, I don't know anything about 'themeing' it out.
You'd need to write a php statement: 'if the url is 'home' then load a css file (with the above over-ride in it)'.
I've no idea how or where you'd do that.

Cheers.

McJustin-1’s picture

Thank you all for replying.

-Anti-. Point 2 (front page module) did the trick. Thank you so much!! I will also take a look at Views and CCK as possible alternatives.

Thank you all again.

drupalbaby’s picture

so i did the changes as referenced in your post if ($page == 0 && !is_front):

and i recieve this error from browser:
Parse error syntax error, unexpected '&" in /home/user/public_html/ubercart/themes/garland/node.tpl.php on line 7

kitt’s picture

There's a dollar sign in front of the is_front (or at least, there should be).


if ($page == 0 && !$is_front) :

$is_front is a variable.

drupalbaby’s picture

oh, this code totally removes the title for the post as well. What could i do to remove the links on the title of each post i make to the front page or any other pages?

neeshpal’s picture

Hello,

Can someone please help
I've given a page node as a default fontpage in administer--> site information. And I tried the above code change in node.tpl.php of bluenile theme but when I view the home page I still can see the title of the page.

nevets’s picture

Page titles are printed in page.tpl.php, you would need similar logic in page.tpl.php where it prints the title. For bluenile replace

<?php if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?>

with

<?php if (!$is_front && $title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?>

to hide the title on the front page.

neeshpal’s picture

Appreciate your reply. It worked. Thanks a lot.

summit’s picture

Bookmarking, greetings, Martijn
Could you also only not show node-title on certain other pages? Like not on taxonomy pages?
Edit: found this: http://drupal.org/node/117491 (need it on D6 :(
greetings,
Martijn

fehin’s picture

This doesn't work once I logout. The title shows again for people not logged in.

charoite’s picture

1) open the sites/all/themes/NAME-OF-THEME folder

2) open the file page.tpl.php

3) do a find (control F usually) for "h1" to find code that looks like this:

 <?php print render($title_prefix); ?>
            <?php if ($title): ?>
            <h1><?php print $title ?></h1>
            <?php endif; ?>
            <?php print render($title_suffix); ?>

4) in the line that reads: if ($title): CHANGE it to if ($title && !$is_front): (ADDING the && !$is_front inside the parenthesis') so it now looks like this

 <?php print render($title_prefix); ?>
            <?php if ($title && !$is_front): ?>
            <h1><?php print $title ?></h1>
            <?php endif; ?>
            <?php print render($title_suffix); ?>

5) save the file

6) reload the page and it should now have removed the title on the front page