i wondering how i can hide $title if its on the front page and on taxonomy pages, I only want it to show on nodes.

here my code, I dont know if im close or not =)

function bartik_process_html($variables){
    $variables['title']['class'][] = 'element invisible';
    $variables['title']['class'][] = 'element invisible';


Just a few notes from what you have so far:

  • I agree with Dave Hall, create a subtheme instead of hacking on Bartik in core
  • Your logic is backwards, you would be looking for if (drupal_is_front_page()) {... instead of if (!drupal_is_front_page()) {...
  • There is no function drupal_is_taxonomy() (unless you created it)
  • The core style is element-invisible instead of two separate classes element invisible (again unless you created these classes separately)

A really easy way to remove these titles is to create simple template files and remove the code that prints the title. For instance, using the code from Bartik's page.tpl.php, copy all the code and create 2 files: page--front.tpl.php and page--taxonomy--term.tpl.php. Inside those files you can remove

<?php print render($title_prefix); ?>
<?php if ($title): ?>
   <h1 class="title" id="page-title">
      <?php print $title; ?>
<?php endif; ?>
<?php print render($title_suffix); ?>

Save the files to your theme, and clear the cache.

| improve this answer | |

Try something like this:

   function hook_preprocess_page(&$variables) {
       if (drupal_is_front_page() || drupal_is_taxonomy()) {
           $variables['title'] = NULL;

Change hook to the name of your theme. Based on your example, it looks like you're hacking core which isn't good. Create a subtheme and implement your custom themeing there.

| improve this answer | |

You can also do it using CSS using classes on the body tag like this :

.front .title {
    display: none;
| improve this answer | |
  • Trust me if I simply wanted a display none I would do it... – Jeremy Love Sep 13 '11 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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