0

I want to disable titles from showing on main content pages, but have them show still on blog post/article pages. I was using a CSS rule #page-title to hide them, and was thinking of working from that, but it doesn't work as well in dynamically generated pages. Comparing a post page to a main content page, I don't see any difference in the preceding css classes and ids.

How could I quickly change this behaviour?

I'm working on a self-built custom theme that doesn't have a lot of editing done to it.

4 Answers 4

1

Take a look at the classes in the body tag, and I am sure you will find what you need to build the right CSS.

Hint: body.SomeClass #page-title { display:none; }

6
  • I tried that already. the class/id hierarchy is 100% identical between posts and pages
    – Damon
    Feb 21, 2012 at 5:22
  • By posts do you mean a list of one or more articles? and a page is the full page with one article?
    – Jens
    Feb 21, 2012 at 5:49
  • Do you have a URL or it's not publicly available ?
    – Jens
    Feb 21, 2012 at 5:49
  • Normally you would have ex: node-type-article in the body, but not in a list of nodes
    – Jens
    Feb 21, 2012 at 5:55
  • I was reading the inspector wrong.. there were differing body classes.
    – Damon
    Mar 15, 2012 at 15:17
2

If these are different content types, you could create a separate node-[type].tpl.php file for each, leaving out the title in one of them.

http://drupal.org/node/1089642

1

under node.tpl.php remove the element including the php if statement:

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

assuming you are using the blog module, under node-[type].tpl.php (which can be found via $node->type) simply keep the element and php if statement.

FYI - this was the default node template from zen. yours may look different.

0

Or just hide it:

  <?php if (!$page): ?>
  <h2<?php print $title_attributes; ?> style="display:none"><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
  <?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.