Omega 3.1 Region-menu.tpl.php coding mistake?

Events happening in the community are now at Drupal community events on www.drupal.org.
jjmonterey's picture

After using Omega 3.1 for almost all my sites for several years, I noticed that page source did notrender the nav tag although the region-menu.tpl.php file clearly had that HTML inserted:

<div<?php print $attributes; ?>>
  <div<?php print $content_attributes; ?>>
    <?php if ($main_menu || $secondary_menu): ?>
    <nav class="navigation">
      <?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix', 'main-menu')), 'heading' => array('text' => t('Main menu'),'level' => 'h2','class' => array('element-invisible')))); ?>
      <?php print theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu', 'class' => array('links', 'inline', 'clearfix', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'),'level' => 'h2','class' => array('element-invisible')))); ?>
    </nav>
    <?php endif; ?>
    <?php print $content; ?>
  </div>
</div>

The above rendered page source as the following:

<div id="zone-menu" class="zone zone-menu clearfix mzone1 container-16">
    <div class="grid-16 region region-menu regmenu1" id="region-menu">
  <div class="region-inner region-menu-inner">
        <div class="block block-system manupmainmenu block-menu block-main-menu block-system-main-menu odd block-without-title" id="block-system-main-menu">

By moving the nav tag HTML up 2 lines:

<div<?php print $attributes; ?>>
  <div<?php print $content_attributes; ?>>
  <nav class="navigation">
    <?php if ($main_menu || $secondary_menu): ?>
      <?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix', 'main-menu')), 'heading' => array('text' => t('Main menu'),'level' => 'h2','class' => array('element-invisible')))); ?>
      <?php print theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu', 'class' => array('links', 'inline', 'clearfix', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'),'level' => 'h2','class' => array('element-invisible')))); ?>
  </nav>
    <?php endif; ?>
    <?php print $content; ?>
  </div>
</div>

The page source rendered the Nav tag sucessfully :

<div id="zone-menu" class="zone zone-menu clearfix mzone1 container-16">
    <div class="grid-16 region region-menu regmenu1" id="region-menu">
  <div class="region-inner region-menu-inner">
  <nav class="navigation">
        <div class="block block-system manupmainmenu block-menu block-main-menu block-system-main-menu odd block-without-title" id="block-system-main-menu">

I don't know for sure how not rendering the nav tag affected accessibility or SEO, but it might have had some effect. If you are using omega 3.1 base theme now (there are more than 20k sites according to Drupal statistics) it might be useful to move the region-menu.tpl.php file into your subtheme's template folder and changing the code as shown above.

Omega Framework

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week