Or you can find the code in the page.tpl.php template in your theme and delete or preferably comment out the code - or try looking in template.php and node.tpl.php
(always remember to back up the original files in case it doesn't work the way you planned!)
I think using css is preferable
I am working on a site with ALL the Drupal features hidden on the front end - for now we're using the back end - I think we will eventually want the community plumbing, so then it'll be easy to roll it out.
About half of the hiding is done with css, some had to be done in the php templates
The pages are made up of individual nodes assembled sort of like php includes
Oh you know I meant how to hide it only on the home page. As you probably know already display: none hides the title tag on every page, as would deleting the statement.
For Drupal 5 see: http://drupal.org/phptemplate. Each of the links to a tpl.php file (ex: node.tpl.php) will list the variables available in that template.
Yeah PHP is the way to go in my opinion. But I inserted that statement and created a $title = 'home' but it didn't remove it... Can you show me an actual live excerpt?
What do you mean by "created a $title = 'home' ", you mean you created content with the title 'home'. Unless you make the content the default front page the title will show when viewing it.
I would guess you are using the default front page (node) and promoting a single node to the front page. Try changing the front page to be just that node (ex: node/123, the 123 will be different for you). You can do this by visiting "Administer" > "Site configuration" > "Site information" and setting "Default front page".
This is a good solution in that it allows you to specify the title of the page in order to single it out by the actual text of the title. However, that's also it's drawback, because what if you change that title? You now have to make sure every page you promote to uses the name you specified in the tpl. But it's still a clever kluge.
I have discovered that hiding the node title has the side-effect of disabling RSS. Has anybody ran into this? Any ideas how to still hide the node title from my home page while keeping RSS enabled?
Hello...this technique worked well for me..but i have another doubt. How to remove ' Posted Sun, 06/06/2010 - 17:32 by Anonymous ' just below the title?
I've tried your approach on page.tpl.php and page-front.tpl.php but I can't seem to get this to work. Do you know if there's anything different I need to do if working on a zen sub-theme?
I found another method useful on my site: create a specific node.tpl.php file for just the node(s) appearing on the front page. Details here: http://drupal.org/node/136647.
I read some of the comments over there. Seriously? How could anyone not think this is a good idea, a most basic feature that should be there. Jeez.
Ok, yes, I come from Joomla too, but I've gotten pretty deep into Drupal too and it's earned quite a bit of respect. This is just such a basic feature to me I find myself really surprised there is no such built-in functionality in it.
Not very good SEO to leave the title tag out of head. Note this does not change the printing of $title on the page which is what the original question is about.
I like the style you use with testing that the $title isn't empty before trying to print it. However in the unusual circumstances that you have a page with no title, do you really still want to print an empty <h1> tag-set into the page?
It might be an improvement to put the IF statement around the whole thing and/or combine the nested IF-statements, e.g.:
An Omega Sub-theme has settings in "Toggle advanced elements" to hide the Page Title, Site Name, Site Slogan with CSS while leaving them accessible to screen readers.
I was wondering isn't there an easier way for beginners like me. May be something so stupid like a toggle box. Or there's no place for such common-sense in the Drupal mind-set? I'd appreciate losing my time to build or to add something instead of losing time just to hide an ugly title that I didn't choose to place it there.
You should always maintain a structured hierarchy of headings within any web page. You should never have a blank heading or even hide it with display:none;. Hiding any content which isn’t viewable by your visitors but is by search engines is against Google’s guidelines as your intention is to only manipulate search engine results by including it. Restyle a H1 so it fits into your design is the best option.
If you still have to hide it then a better option would be to either create a template for that node, content type or page and simply not print the heading.
Or if you want to use CSS then use position:absolute so the heading doesn’t use any space where it is located in the page and text-indent:-9999px; so the text is moved off the screen and no longer visible but at least can be read by screen readers and search engines.
Rather than copy page.tpl.php it would be easier to maintain a single copy and instead implement hook_preprocess_page() and hide the title element by setting '#access' to false
Comments
two ways, css and php
You can set its css to display: none;
Or you can find the code in the page.tpl.php template in your theme and delete or preferably comment out the code - or try looking in template.php and node.tpl.php
(always remember to back up the original files in case it doesn't work the way you planned!)
I think using css is preferable
I am working on a site with ALL the Drupal features hidden on the front end - for now we're using the back end - I think we will eventually want the community plumbing, so then it'll be easy to roll it out.
About half of the hiding is done with css, some had to be done in the php templates
The pages are made up of individual nodes assembled sort of like php includes
http://jcat.netsperience.org/
I also had to create a dedicated admin page for login and site management.
~are you netsperienced? http://netsperience.org
~are you netsperienced?
♥ follow me @decibelplaces ∞
Oh you know I meant how to
Oh you know I meant how to hide it only on the home page. As you probably know already display: none hides the title tag on every page, as would deleting the statement.
Thanks!
Spence
http://www.spencerhill.us
how about javascript?
Use some js to test the location and hide/display accordingly...
replace titleid with id of title in your theme that you want to hide-
should work....
haven't tested it, but give it a try
~are you netsperienced? http://netsperience.org
~are you netsperienced?
♥ follow me @decibelplaces ∞
Another approach, at the top
Another approach, at the top of page.tpl.php add
this will unset the title when view the front page (so it should not print).
use the php code
Yeah, I think the php solution looks better
Is there a list of Drupal variables and tokens somewhere on this sprawling site, and tips on manipulating them?
~are you netsperienced? http://netsperience.org
~are you netsperienced?
♥ follow me @decibelplaces ∞
For Drupal 5 see:
For Drupal 5 see: http://drupal.org/phptemplate. Each of the links to a tpl.php file (ex: node.tpl.php) will list the variables available in that template.
Yeah PHP is the way to go in
Yeah PHP is the way to go in my opinion. But I inserted that statement and created a $title = 'home' but it didn't remove it... Can you show me an actual live excerpt?
Thanks!
Spence
http://www.spencerhill.us
What do you mean by "created
What do you mean by "created a $title = 'home' ", you mean you created content with the title 'home'. Unless you make the content the default front page the title will show when viewing it.
I mean I made the following
I mean I made the following modification to the PHP you gave me and inserted it in the head of page.tpl.php:
Thanks!
Spence
http://www.spencerhill.us
I added a semi-colon after
I added a semi-colon after
$title = 'home'and placed the code segment right at the start of page.tpl.php and it worked fine.Hm... still doesn't seem to
Hm... still doesn't seem to be working for me... You mind taking a look at the site and the code for it?
http://www.spencerhill.us/green-dragon
You'll notice the linked title "Intro" at the top. That's what I'm trying to hide.
Thanks!
Spence
http://www.spencerhill.us
It's not a page title :)
I would guess you are using the default front page (node) and promoting a single node to the front page. Try changing the front page to be just that node (ex: node/123, the 123 will be different for you). You can do this by visiting "Administer" > "Site configuration" > "Site information" and setting "Default front page".
You are the man. That was
You are the man. That was it.
Thanks!
Spence
http://www.spencerhill.us
Good Solution
This is a good solution in that it allows you to specify the title of the page in order to single it out by the actual text of the title. However, that's also it's drawback, because what if you change that title? You now have to make sure every page you promote to uses the name you specified in the tpl. But it's still a clever kluge.
Thanks..
This worked for me , with box_grey theme.
...disables RSS
I have discovered that hiding the node title has the side-effect of disabling RSS. Has anybody ran into this? Any ideas how to still hide the node title from my home page while keeping RSS enabled?
I hadn't noticed that,
I hadn't noticed that, either, but you're right!
RSS feed is gone now! How do we get that back?
I added rss to the sidebar,
I added rss to the sidebar, but I'm not sure if the code is suppressing the front feed or not
how to remove --->Posted Sun, 06/06/2010 - 17:32 by Anonymous
Hello...this technique worked well for me..but i have another doubt. How to remove ' Posted Sun, 06/06/2010 - 17:32 by Anonymous ' just below the title?
I've tried your approach on
I've tried your approach on page.tpl.php and page-front.tpl.php but I can't seem to get this to work. Do you know if there's anything different I need to do if working on a zen sub-theme?
easy in Zen
You are in luck because Zen makes it super easy. There is a class called "front."
So something like:
is the quick solution to your problem.
A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com
thanks
Useful
I found another method
I found another method useful on my site: create a specific node.tpl.php file for just the node(s) appearing on the front page. Details here: http://drupal.org/node/136647.
Anthony
I opened a feature request
I opened a feature request for this at #639966: Let us hide title on default front page.
Thanks--Good Idea
I read some of the comments over there. Seriously? How could anyone not think this is a good idea, a most basic feature that should be there. Jeez.
Ok, yes, I come from Joomla too, but I've gotten pretty deep into Drupal too and it's earned quite a bit of respect. This is just such a basic feature to me I find myself really surprised there is no such built-in functionality in it.
page-front.tpl.php
Instead of unset($title) which erases variables, why not copy your page.tpl.php to page-front.tpl.php.
At the top of the page-front.tpl.php, don't print the $title, eg at the top of page-front.tpl.php:
Joe
http://www.hydeinteractive.com/
Local News Platform Built on Drupal
http://sanangelolive.com/
why comment it out?
@jghyde
is a cleaner way...
~are you netsperienced?
♥ follow me @decibelplaces ∞
Not very good SEO to leave
Not very good SEO to leave the title tag out of head. Note this does not change the printing of $title on the page which is what the original question is about.
good point
@nevets
you're right, this affects the DOM title but not the page title...
I have also found that when CSS alone cannot be specific enough, a bit of jQuery can work miracles eg #807014: exclude specific users and roles (eg admin) from public User List
~are you netsperienced?
♥ follow me @decibelplaces ∞
Using php in page.tpl.php
Here is how I solved this issue, using page.tpl.php:
It's good form that you check that title is set...
I like the style you use with testing that the
$titleisn't empty before trying to print it. However in the unusual circumstances that you have a page with no title, do you really still want to print an empty<h1>tag-set into the page?It might be an improvement to put the IF statement around the whole thing and/or combine the nested IF-statements, e.g.:
See you at the Drupalcon!
Hide Page Title with Omega Theme Settings in Drupal 7
An Omega Sub-theme has settings in "Toggle advanced elements" to hide the Page Title, Site Name, Site Slogan with CSS while leaving them accessible to screen readers.
see http://drupal.org/node/1298698
Yet another way :D
~are you netsperienced?
♥ follow me @decibelplaces ∞
Hide Home Page Title Only
This worked like a charm; thanks!
Hi I am using omega
Hi
I am using omega theme.
Add these lines of code in your template.php
You can use print_r($vars['page']['content']); to see the variable which is printing this value
and accordingly you can manage it.
do use drupal_is_front_page() function otherwise it will hide page title for complete site.
/**
* Implements hook_process_page().
*/
function themename_process_page(&$vars){
if(drupal_is_front_page()) {
$vars['title']='';
unset($vars['page']['content']['content']['content']['system_main']['default_message']);
}
}
Thanks
aniket_m
All of these lines of code, just to hide a simple title!
I was wondering isn't there an easier way for beginners like me. May be something so stupid like a toggle box. Or there's no place for such common-sense in the Drupal mind-set? I'd appreciate losing my time to build or to add something instead of losing time just to hide an ugly title that I didn't choose to place it there.
=-=
No. There isn't a theme setting (toggle) in core to handle this.
FYI: The above code removed
Juliadvw's solution working for me --
I replaced this
if ($title):print $title;endif;in the page.tpl.php (main div section) with Julia's code and it worked perfectly for me. Hope this helps others.
(sorry, I don't know why the code breaks up into short sections when posted)
Every page should contain a
Every page should contain a heading.
You should always maintain a structured hierarchy of headings within any web page. You should never have a blank heading or even hide it with display:none;. Hiding any content which isn’t viewable by your visitors but is by search engines is against Google’s guidelines as your intention is to only manipulate search engine results by including it. Restyle a H1 so it fits into your design is the best option.
If you still have to hide it then a better option would be to either create a template for that node, content type or page and simply not print the heading.
Or if you want to use CSS then use position:absolute so the heading doesn’t use any space where it is located in the page and text-indent:-9999px; so the text is moved off the screen and no longer visible but at least can be read by screen readers and search engines.
page--front.tpl.php
In Drupal 7, copy page.tpl.php to page--front.tpl.php, which is a template overide for the front page only, and delete the title code.
Rather than copy page.tpl.php
Rather than copy page.tpl.php it would be easier to maintain a single copy and instead implement hook_preprocess_page() and hide the title element by setting '#access' to false
Yes. You are right
Yes. You are right. We can always use preprocess hook
How do I hide the page title on my home page?
I have Create new code Page Title hide in my home page..
template.php
function _themename_hide_page_title()
{
global $user;
$return_value = TRUE;
$current_path = current_path();
$patterns = theme_get_setting('hide_page_title');
if (empty($patterns)) {
return TRUE;
}
if (defined('LOGIN_REGISTER_ON_PAGE') && LOGIN_REGISTER_ON_PAGE && !$user->uid) {
$patterns .= "\n" . "user";
}
$path_alias = drupal_lookup_path('alias', $current_path);
if (drupal_match_path($current_path, $patterns) || drupal_match_path($path_alias, $patterns)) {
$return_value = FALSE;
}
return $return_value;
}