Fix for Hide title for pages in the primary links menu

  1. /**
  2.  * Hide the title of the page if there is an entry for its path in the primary-menu (at any depth).
  3.  * Usefull when primary links use huge font, to avoid repeating the same information on screen.
  4.  *
  5.  
  6. * Add this in style.css
  7.  * .in-primary-links #page-title {display: none;}
  8.  */
  9. function THEME_preprocess_page(&$vars, $hook) {
  10.   $items = array();
  11.   $level = 0;
  12.   while($items[$level] = menu_navigation_links('primary-links', $level)) {
  13.     $level ++;
  14.   }
  15.   if($level > 0) {
  16.     foreach($items[$level - 1] as $item) {
  17.       if($item['href'] == $_GET['q']) {
  18.         $vars['body_classes'] .= ' in-primary-links';
  19.       }
  20.     }
  21.   }
  22. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.