On #drupal irc, Rob Loach mentioned the possibility of being able to *hide the node title* aside from just being able to apply bold / italic styling.

For the CSS, my suggestion is to either do of the following:

(a) cssRulehere {display:none;}
(b) cssRulehere {line-height:0; overflow:hidden;}

I'll go in favor of b.

Comments

colorado’s picture

Issue tags: +remove title, +hide node title, +supress title display, +hide title display
StatusFileSize
new7.93 KB

I've attached a new module called Hide Title. It is just made by a small addition to this module (and then re-rolled), which just wraps the title in some inline css (display:none) to hide or remove the title of the node when the page is viewed. Just add two dashes to the beginning and end of your title text in the node editor, like this:

--Node Title Goes Here--

I just added the following rule:

'/\-\-([^(\-\-)]*)\-\-/' => '<span style="display:none">${1}</span>',

and here is the entire function where I inserted the new rule to make the module:

/**
 * Format given node title.
 */
function hide_title_parse($title) {
  $rules = array(
    '/\*\*([^(\*\*)]*)\*\*/' => '<strong>${1}</strong>',
    '/__([^(__)]*)__/' => '<i>${1}</i>',
    '/\-\-([^(\-\-)]*)\-\-/' => '<span style="display:none">${1}</span>',
  );
  foreach ($rules as $r => $f) {
    $title = preg_replace($r, $f, $title);
  }
  return $title;
}

This rule could be simply added to the Formatted Title module.

But since I have seen so many people needing, and searching for this one simple feature (to selectively hide the node title for an individual node, directly on the node edit page), I thought that maybe the name of the module, Hide Title, would be descriptive enough to help people find this...

I hope it helps someone.

colorado’s picture

StatusFileSize
new7.93 KB

Here is the hide title module zipped up for you to download. Just unzip and install as a normal module.

If you have trouble with the module not working, then try removing the one file called views_handler_field_hide_title.inc, and it will not affect anything negatively.

EDIT (6-14-2010) - I have also attached a hide_title.zip file with the views_handler_field_hide_title.inc file removed, you can find it down several posts below this one...

Luijten’s picture

Thank you for creating this module!
It works, but not on the front page. There, the title "--welcome--" appears on my screen. Do you know how I can remove this?
Regards,

Jo Luijten

johan2’s picture

Hi,

I also tried this module in a fusion theme.
It works but a big disadvantage is that in the content list the titles of all the nodes disappeared.
Also I have to mention that I had to remove the "views_handler_field_hide_title.inc" from the module because it turned the content list to a blank page.
Is there a way to solve this?
An other solution is to make a hidetitlenode-type with a hidetitlepage.tpl.php with a hide title css.
But also this last solution has disadvantages by its limitation to 1 node-type and the issue of remembering what you have added to a theme before upgrading or switching to other themes.
So I am in favor for a good module but without loss of the functionality of the existing core.

Is there a solution?
Regards Johan

colorado’s picture

StatusFileSize
new7.5 KB

Here is the hide title module with the views_handler_field_hide_title.inc file removed. Just unzip and install as a normal module.

colorado’s picture

Thank you johan2:

I also tried this module in a fusion theme... in the content list the titles of all the nodes disappeared.

I could not replicate the disappearing node titles in the content list.

An other solution is to make a hidetitlenode-type with a hidetitlepage.tpl.php with a hide title css.

Yes you can do it that way too. I shared this module just to enable content editors to supress the Title on the page display very simply and directly as they create a new page on the site (any single page, of any node type), without having to write code or create new template files.

So I am in favor for a good module but without loss of the functionality of the existing core.

I haven't been able to find any loss of functionality of the existing core.

Maybe another module you are using is already altering the core functionality of the page title (i.e. the Page Title module, or something in the Fusion theme?) Please post here what theme and other contrib modules you are using that may be affecting or changing the way the page title displays.

colorado’s picture

StatusFileSize
new7.59 KB

Attached is another version of the above (last) version of hide_title which uses

{line-height:0; overflow:hidden;} (this attached version also removes the blank space where the title was)

instead of

{display:none;} (which the previous version used, that also left the extra space in place of the title)

zap-admin’s picture

Colorado..... Thanks for making such a cool little module. I'm just barely beyond a total newbie but I thought I'd let you know that I had a problem with this in the Danland Theme. Don't worry, I can live not being able to remove the title on the site I'm working on. I think I can make it work via another route..... as in creating a view that's just involved with showing a graphic which links to my Youtube channel and twitter homepage. Or by using Panels module.....

Oh... duh.... when I put the two dashes before and after the Title for the node it just shows the title for the node with the dashes in the block that I'm displaying the node in. Maybe the fact I'm displaying the node in a block is affecting it. Anyway, I just thought I'd post this info for the record. The title originally had spaces between 3 words followed with a ":". I tried putting both underscores in place of the spaces, and removing the ":" from the title name but it netted me the same result.

Thanks again for taking the time to write this module. I'm sure a ton of people will get a lot of use out of it.

Z

johan2’s picture

Hi,

I also moved on to find another solution by working with the views. With a view you can decide to have no title.
So I worked with some views.
In a node you expect to have a title but the output of some nodes to a view can be without a title.
Nevertheless I will try the module again to see if it works with fusion.

Regards Johan

miclovio’s picture

Hello, i downloaded and installed this module but decided it wasn't what i wanted and removed it. Now my front page is not displaying in IE and only in Firefox. I have no clue how to fix it and thought maybe it has to do with CSS but not sure which one. Please help! Here is the link:
http://67.222.102.11/~indian/

colorado’s picture

Thank you miclovio,

I cannot see any error on your site. It displays perfectly well in both IE and Firefox...

ScoutX’s picture

I could replicate the disappearing node titles in the content list. I used your version 2. Themes are Admin Theme and Garland (heavy modified). Both hide the titles in the list.
I tried other themes aswell to no awail.

Problem is: <th class="views-field views-field-title"><a class="active" title="sort by Title" href="/admin/content/node?order=title&amp;sort=asc">Title</a>
This line have to be there.

With an active module you can't get any processed title.
Seems to be there is a nasty code for the content list page to hide all irrelevant options. It begins with:
<table class="sticky-header" style="position: fixed; top: 0px; width: 1010px; left: 551.5px; visibility: hidden;">

Within this tag, you can find: <input type="checkbox" class="form-checkbox" title="Select all rows in this table">
The row for the title is missing with an active module.
<th class="views-field views-field-title"><a class="active" title="sort by Title" href="/admin/content/node?order=title&amp;sort=asc">Title</a></th>

It's not a browser issue, although most of the time i use FF 3.6 in Windows and Linux.

I'm sure the error have to be in your code. I tried to debug the issue, without success. But all debugs told me, that the function title isn´t parsed at all.

I´m out of ideas to fix this error.

p.s. there is a high chance, that this code destroys some serious css parsing within the maintheme.css

colorado’s picture

Yes the V2 displays this behavior for me as well. Unless/until I figure out why, just use V1 above from #5 ( http://drupal.org/comment/reply/495738/3272946#comment-3087912 )

leehquk’s picture

I have messed with my CSS code for eternity trying to solve the problem you have just solved in one easy module...thank you.

However just to note, I unzipped V2 and tried to use with fusion core/acquia_marina but with no success. I rolled back to V1 and hey presto it worked.

You sir have saved my sanity

colorado’s picture

Thank you for the kudos leehquk! I'm happy that someone else found this useful :-D

summit’s picture

Subscribing, would this also be possible on nodetype level?
greetings, Martijn

develcuy’s picture

Status: Active » Closed (won't fix)