I have seen other themes that just define regions and then use drupals theme() function in the page.tpl.php to print the Main menu wherever the developer pleases.

This was not the case for me, and I spent a lot of time figuring out that for some reason I had to both add 'features[] = main_menu' into the theme .info file, as well as going to 'admin/appearance/settings/themename' and enable the feature before it will display.

I'm having trouble understanding why this is the case, and hope someone can elucidate or at least point me towards some enlightening documentation. Thanks.

  • What version of Drupal are you using? Are you using a base theme or editing a contrib theme, or is your theme completely custom? – sheena_d Apr 18 '12 at 8:39
  • This is my first attempt at creating a theme from scratch. – bitfed Apr 18 '12 at 15:08

The features elements in the .info file are used to add or suppress Drupal core/global theme settings. If you add any features options to your .info file, you must add all of the options you wish to have available to your theme. All of the options are included by default if no features options are added to the theme's .info file.

If you want to set the default setting for any of these features to your theme's .info file, you can use the setting entry. For example, if you wanted to default the "main_menu" option to be on, you would add this to .info:

setting[toggle_main_menu] = 1

More information on all of these topics can be found in the drupal.org Theming Guide

  • Thanks for the explanation and the link, but I don't understand why I have been forced to declare my features to begin with. Why aren't these core features available to my theme out of the box? – bitfed Apr 19 '12 at 7:08
  • If you add no core features to your .info file, then they will all be available, unless you have a base theme that has stripped them out somehow. Also, if you have added any customizations to theme-settings.php in your theme, it is possible that you may have inadvertently effected these core features. – sheena_d Apr 19 '12 at 14:25
  • I have not edited the theme-settings.php, and there was no base theme used, yet they appear stripped out. – bitfed May 11 '12 at 12:59
  • According to the documentation, if you have no lines in your theme's .info file that begin with features then all of the core theme settings should be available to your theme. It is possible that you are using the wrong code in your page.tpl.php file to print out the main menu or there are a dozen other factors that could be in play. It is impossible to know what the cause is without having direct access to your theme and site, but analyzing your specific theme runs outside the scope of this forum. – sheena_d May 11 '12 at 15:34
  • Thanks for your help so far, but how is that outside the scope of Drupal Answers? I could easily create a post showing all of these things and linking to the text of the files. – bitfed May 13 '12 at 5:46

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.