I have an issue where I have created a menu within Drupal, assigned the block created by that menu to a region and set it to display on certain pages, but it's not displaying.

It's a Drupal 7 site (v 7.31)

Here's how it's set up:

  • Menu created
  • Block for menu was automatically created when menu was created
  • Block is assigned to appear in a region (Sidebar First) in my theme
  • Block is assigned to appear only on pages with certain path patterns (foo/*)
  • Pages with those patterns exist (e.g. foo/bar)
  • Some pages with these URL patterns do have multiple URL aliases assigned to that page, but other pages do not. The issue is the same
  • The Context module is installed/enabled on the site but there are no enabled rules/conditions associated with these pages
  • The site uses the Omega theme (7.x-3.1), but there are no enabled Delta settings on these pages either.

So far, I have:

  • Deleted and recreated the menu
  • Cleared the cache, multiple times before and after creating the menu, using the UI and Drush
  • Tried creating/deleting the menu on an earlier backup of the site (running 7.26)
  • Used the regular block created by the built in Drupal menu module, and tried using MenuBlock
  • Created a dummy regular block and assigned it to Sidebar First on the same pages - this did not display either
  • Checked the source code to see if the menu was appearing (and maybe not being displayed by the CSS) - it wasn't appearing in the code either
  • Tried assigning the block to a different region. Assigning the block to Sidebar Second produced the same issue, but assigning it to the "Content" section display the block below the content.
  • Did you try to remove the page restrictions to see if it shows up at all? – Paul Oct 13 '14 at 13:01
  • Yes, but no difference. The menu doesn't display at all. – Iarla Oct 13 '14 at 13:07
  • Well, there are numerous possible reasons. Is the menu present in the source code (and just not displayed due to CSS rules or hidden by other elements)? If not, try to disable modules like Context one by one to see if at some point your menu appears. Do you have a link where we can take a look? – Paul Oct 13 '14 at 13:14
  • Of course, it's hard to see something, that is not there. ;) But what I do see is that there are no sidebars at all. Did you try to add another (working) block to the first sidebar? – Paul Oct 13 '14 at 13:43
  • I've added an otherwise working block to the sidebar first - It didn't display. I've also checked as to whether there's anything potentially affecting it in the PHP code for the theme and I can't see anything. I thought it might have been an issue arising from a 7.26 to 7.31 upgrade, but the issue is the same on the 7.26 version of the site. – Iarla Oct 13 '14 at 13:50

The issue in this case was that the site was set up so that the sidebar_first region only displayed if explicitly directed to do so by the Delta module used with the Omega theme.

If there was not an explicit Delta rule telling Drupal to display the sidebar_first region, then by default it wasn't displayed.


It's definitely your theme that is at fault. I'm not familiar with Omega; I personally never use third-party base themes. They make the whole process more complex, IMHO. If you are skilled with HTML/CSS, there's no reason to use a base theme like Omega. You may find more information on what you are trying to achieve here.

Other than that, here are a few suggestions about debugging your theme:

A) Check you .info file.

In your .info file, you should have a few lines defining what regions are available to your theme. These regions are not inherited from the parent theme ! You must explicitly define them as follows:

regions[content] = Content
regions[sidebar_first] = Left sidebar
regions[sidebar_second] = Right sidebar

If you needed to add these lines, don't forget to clear your site cache.

B) Check your templates

This is not necessary if you inherit the page.tpl.php template file from the parent theme, unless you don't use the exact same regions. Note that, because you don't inherit them in the first place, this is often source of confusion. If you use different regions, you must also have your own page.tpl.php file.

This sucks, but it's just the way it is.

Another, pretty common, mistake is to print these regions in Drupal 6 style. If you use this in your template:

print $sidebar_first;

you're doing it wrong. The Drupal 7 syntax is:

print render($page['sidebar_first']);

It's ugly, but what can you do ? (actually you can do something about it, but that's out of this scope).

C) Clear cache, clear cache, clear cache...

Drupal 7 is very resilient when it comes to clearing caches. Everything is in a cache somewhere. Make sure you clear the caches every time you create a new template file, you add a new hook (especially preprocess hooks) or make any changes to the .info file.

  • This author's opinion about using a base theme is not a widely held opinion in the Drupal community. Base themes usually make your work a lot easier and result in better markup. There are occasional gotchas. – Alan Dixon Jul 28 '15 at 21:22

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.