Im working on my custom theme (modified stark theme) and there is a main menu in page.tpl.php generated by:

<?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'gold')))); ?>

I want to define my own html for main menu so I created a template.php file with this function:

function budo_links__system_main_menu($variables) {
  $html = "<div style='background-color:red;'>\n";
  $html .= "  <ul>\n";  
  foreach ($variables['links'] as $link) {
    $html .= "<li>".l($link['title'], $link['path'], $link)."</li>";
  $html .= "  </ul>\n";
  $html .= "</div>\n";
  return $html;

where budo is a name of my theme. But menu is still generated old way and not by this new function. It should work according to this explanation, but it doesn't even if I flush cache. Did I forget something?

  • 1
    I run your code and working fine. There can be some other kind of silly mistake. :) – Sumit Madan Mar 31 '15 at 11:11
  • yes, I forgot to change name of theme.info – Incredible Mar 31 '15 at 11:20
  • Yeah!! That happens to me sometimes too. :) – Sumit Madan Mar 31 '15 at 11:22

Your Answer

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

Browse other questions tagged or ask your own question.