0

I'm creating a custom theme in Drupal 7 but I'm having trouble getting it to render the menu

I'm using the following code in page-front.tpl.php

<?php if ($page['main_menu']): ?>
    <div id="main-menu"><div class="section clearfix">
<?php print render($page['main_menu']); ?>
    </div></div>

But it does not render anything. I have double checked that a menu exists.

1 Answer 1

1

$page['main_menu'] is not menu. It's the region with name main_menu. You can put there any block what you want. You can configure blocks on this page admin/structure/block

But in the basic drupal themes the main menu can be available in this variable $main_menu in the template page.tpl.php

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.