3

I'm building a drupal 7 bootstrap sub theme and want to hide the title of the nodes if there on the home page. I don't want to use css as its only hiding it I want to have the titles not render at all.

i have tried hook_preprocess_page() but didnt work:

function mytheme_preprocess_page(&$vars) {
    if ($vars['is_front']) {
        $vars['title'] = '';
    }
}

2 Answers 2

4

Your close with hook_preprocess_page() but as you want to hide the node title (and not the page title) you need to use hook_preprocess_node() instead.

0
0

Going via hook_preprocess_page() this one worked for me:

function MYTHEME_preprocess_page(&$vars) {
  if( drupal_is_front_page() ) drupal_set_title('');
}

Your Answer

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

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