0

I need to hide the title on a custom page created using hook_menu. I don't have a nid, so probably I can't use one of the existing modules to do that.

function mymodule_menu() {
  $items['mypath'] = array(
    'title' => 'My title',
    'page callback' => 'mymodule_page_callback',
    'access arguments' => array('access content')
  );
  return $items;
}

I know this could be done using this css

body#pid-mypath {
  h1.title {
    display: none
  }
}

but I want to know if there are other alternatives. I'm working with Drupal 6.

1 Answer 1

1

Not sure if processed on time but I would try using drupal_set_title. And making sure you have an if statement around the h1 or h2. So use drupal_set_title to create empty title and use:

if(!empty($title)){
echo '<h1>' . $title . '</h1>';
}
1
  • Worked with drupal_set_title('') on the mymodule_page_callback function. Thanks.
    – Camilo
    Commented Dec 4, 2014 at 21:48

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.