By Griff1324 on
I am running Drupal 6 and I would like to be able to hide the node titles so that they don't display on the page. I only want to do this on certain pages. How can I accomplish this?
Thanks!
Chris
I am running Drupal 6 and I would like to be able to hide the node titles so that they don't display on the page. I only want to do this on certain pages. How can I accomplish this?
Thanks!
Chris
Comments
anyone?
anyone?
Hide Node Titles in Drupal 6
In the page.tpl.php file of your theme look for the follwing code-snippet:
....................
.........................
Change the line with class="title" into:
<h1 class="title"><?php if ($node->nid == node_number_of your_page) {print $title;} ?> </h1>and substitute in the above your actual node-number for: node_number_of your_page.
The title is then only displayed on that page. Of course you could extend the condition of the 'if'-statement to include/exclude other nodes.
Sometimes the "Drupal" way
Sometimes the "Drupal" way of always making the most rudimentary things hard as hell to accomplish is laughable. :P
If it weren't so
If it weren't so 'laughable', it wouldn't scale, updates would be impossible, theme agnosticism would be impossible... etc. etc.
You can use this module:
You can use this module: http://drupal.org/project/auto_nodetitle
yay! it scaled!
yay! it scaled!
Expanding on what wimvb said
auto_nodetitle hides the title from the data entry form. It creates a title for you. But it does not prevent the title from displaying.
Using the tip above on my Zen theme I did the folowing:
•I copied page.tpl.php out of the Zen folder and into my theme.
• I found the section that looked like this:
On my site node 8 was the one I was targeting to NOT have a title. So that line says if we are not on node 8, print the title.
Hope this helps someone.
A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com
why php?
isn't views created just to handle how nodes are to be handled ?
I'm going to try the auto nodetitle now, and if it does what it sais it should be the perfect solution together with views...
Yes, it helped! I spent more
Yes, it helped!
I spent more than one hour solving this trivial issue.
It is absolutely abnormal that Drupal does not propose natively the option to hide the title at the content type and node levels.
Even this trick is unacceptable as you must modify a theme so the change will be dismissed as soon as youy switch to another theme or the theme is updated.
This is a hack, not a solution.
Is there any way top do this change at the Drupal level, as a module (because new feature are forbidden at this stage - though this is almost a bug...) ?
JV
auto_nodetitle worked for me
Ok, I'm a novice and know nothing about coding etc, but I got auto_nodetitle to hide the node title for me after a bit of playing around. Here's how:
I have the Token module installed as suggested in the readme of the auto_nodetitle module.
In "Home » Administer » Content management", click 'edit' for the type of content in which you want to hide the node titles (page in my case) and open the "Automatic title generation" menu.
Enable the "Automatically generate the title if the title field is left empty" option.
In the "Pattern for the title:" field type in the
[title]pattern.Now in your newly created node you leave the title blank.
That was it. Worked for me. Perhaps it's a fluke....
The beauty is that when you do want a title, you just type it in as per normal.
To do this retrospectively on already created nodes, follow the instructions in the readme of the auto_nodetitle module:
This is the most elegant way
This is the most elegant way to do it by far!
Thank you very much.
JV
Major drawback though
You can't see what the content is about anymore in your content list (admin/content/node) or blocks (admin/build/block). This may not be a problem in case of a limited use, but if you use multiple nodes or blocks like these, it may become a real pain!
Is there a way this module can resolve this?
P.S.: Updating content with this is not really working for me. The title won't disappear after a save (after being updated as described, clearing the cache and removing the title in the node itself. I'm combining it with nodeasblock, giving it a block title sometimes - same issue. Once it's there, it won't go away.
Modules can change template variables like 'title' in code
It's possible for any module to change the variables that get sent to different template files using the hook_preprocess_HOOK function. For the page title we need to be changing the variables that are part of the template_preprocess_page function. So if we want to affect the page title through a custom module we need to create a function called hook_preprocess_page (and replace that first 'hook' with our module name of course!).
Let's pretend we've created a module called persistent_title.module. Here's the code we'd need to add:
If we only wanted the title to be changed on certain paths we need to add some code that checks for the condition we want:
You can do this with CSS
If your theme makes use of the
$body_classesvariable you should be able to target content types and specific nodes. For example with zen, you could have CSS like.node-type-page h1.title {display:none;}to remove all titles from page nodes.
hide node title using inline css
isn't there an easy way to hide the node title by using an in line css override? so not to have to edit any files.
shouldnt this work with other headers in CSS too?
I have been trying to get rid of the post-headers from my website but no such luck. (http://drupal.org/node/759100)
And also i don't want to have that post-header on any of my pages, old or new ones, they all shall be clean from it.
So i tried the CSS you supplied and changed h1 to h2 and placed it in the end of the themes CSS sheet, but sadly, no joy.
Shouldn't it actually work? it seems to me as it´s kinda the same principle.
Do any of you suggest any other ways to get rid of the annoying post-header?
Any input what so ever is appreciated.
Best regards
Peter
Careful with "display: none" on content
When elements with
display: nonecontain actual content that can be considered as relevant by search engines, it could damage your SEO (often used as blackhat technique).How can I use the method that
How can I use the method that was mentioned above ( http://drupal.org/node/265773#comment-1631630 ) to hide tabs from a single node, say, number 23?
Anyone?
Anyone?
Please consider this
Please consider this instead
http://drupal.org/node/265773#comment-3055470
I hate modifying themes' or modules' files, and it will be tricky to change the tpl file each time a new node needs hidding its title.
Just use auto node title module as indicated: you can have the title displayed, hidden os created automatically as you want.
JV
Yes, thanks, but I'm asking
Yes, thanks, but I'm asking how to do the same thing to remove tabs, not titles.
New thread
Titles and tabs don't have all that much to do with each other. They come from different places and are displayed differently. You should either start a new thread or (better yet) do a search for: "how do I remove tabs" and read some of the answers. I bet that will lead you to a theming solution or a module (like tab tamer) in no time.
Good Luck!
A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com
Have a look at this
http://drupal.org/node/495738
Hi, Hiding tabs in specific
Hi,
Hiding tabs in specific node
in your page.tpl.php
Change 23 with your node id
Jonathan Hindi
node title
.node-type-page h1.title {display:none;}
thanx this is working thanx a lot
no available solution yet
I don't want to hide all the titles, just some.
This module does what I need :
http://drupal.org/project/exclude_node_title
Best one (if using cck)
http://addoa.com/blog/how-make-optionally-hide-node-titles-drupal-using-cck