i've added the code below to my theme's template.php file. i've cleared the cache too. but this just isn't firing no matter what. i'm not getting any errors either.

anyone have any experience with this function? i am using a sub-theme of the Adaptive theme. don't know if that has anything to do with it.

function spn_at_links__system_main_menu($variables) {
 echo '<script>alert("sys menu func running")</script>';
 $html = "<div class='myclass'>";
 $html .= "  <ul>";  
 foreach ($variables['links'] as $link) {
   $html .= "<li>".l($link['title'], $link['path'], $link)."</li>";
 $html .= "  </ul>";
 $html .= "</div>";

 return $html;

yes my theme name is spn_at with an underscore. i have other theme related function working just fine in the template.php file. big thanks for any help w/ this

  • How is your main menu rendered?
    – Clive
    Aug 23, 2014 at 18:47

1 Answer 1


The Adaptive theme never calls links__system_main_menu from its page.tpl.php file, hence providing an override has no effect and it falls back to theme_links. If you want to override it you will have to provide your own theme suggestion in preprocess hook function.

Look here for more info: THE DEFINITIVE GUIDE TO DRUPAL 7

  • $variables['theme_hook_suggestions'][] = 'spn_at_links__system_main_menu';
    – TopTomato
    Aug 23, 2014 at 19:07
  • obvious maybe, it did not work. actually it made all my menus disappear!, til i removed and cleared the cache
    – TopTomato
    Aug 23, 2014 at 19:08

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.