1

I've started my first custom theme and I pulled the main-menu print statement from the default page.tpl but it didn't display. Curiously, if I create a region and add the main menu to that region via the blocks administration it will show up. Why won't this show when hard-coded?

<?php if ($main_menu || $secondary_menu): ?>
  <div id="navigation"><div class="section">
    <?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => t('Main menu'))); ?>
    <?php print theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => t('Secondary menu'))); ?>
  </div></div> <!-- /.section, /#navigation -->
<?php endif; ?>

If I switch the theme over to Bartik, that uses the exact same print statement, the menu seems to work fine.

6

I spent countless hours figuring it out as well; the solution was so dumb simple !

Edit your theme's ".info" file and add :

features[] = main_menu
features[] = secondary_menu

Otherwise main_menu and secondary_menu doesn't display at all.

Hope that helps.

Your Answer

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

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