0

I have a custom main theme for my website along with a Blog theme using themeswitcher. All content in my /blog directory uses the Blog theme.

Question: I would like to display different links in the main menu when users are on my blog theme vs. main website theme. If I choose to display the Primary Menu in my blog theme all of my main website links show up. Are there any menu Modules that allow enable/disable links based on directory and/or pages?

I there an easy way to do this?

1

You will need to mange the links in 2 different menus. for example Main Menu for all website links and Blog Menu to have the links related to Blog pages.

Disable the Main Menu and the Secondary Menus from your theme settings.

Now goto blocks pages and configure the main menu block scroll down to bottom

under Show block on specific pages

select All pages except those listed and type blog/*

now save this block configuration and goto configure Blog Menu scroll down to bottom and select Only the listed pages and type the same in texarea ( blog/* ) and save the block configuration.

Now depending on your URL pattern it will display your required menu.

  • My main website menu is not a block, it's uses the Drupal Menu system. – John Jan 17 '14 at 15:06
  • If you goto admin/appearance/settings/YOUR_THEME there is an option to disable Main Menu and Secondary Menu. Just disable them from there and use the Main Menu and Blog Menu through Blocks. – Fahad Jan 17 '14 at 19:43
  • Won't that disable the menu in my custom theme? It's part of the main website, the blog is in a sub-directory and I'm using the ThemeKey module to change the look of the website when people go to the Blog directory. – John Jan 20 '14 at 16:03
  • Each menu automatically creates a block of the same name. There are actually 2 methods of displaying menus in your theme, first one is normally by hard coding the menus in your theme page.tpl.php and 2nd is to just create region for your menus in your tpl file and then place the menu through blocks management page in your desired region. By disabling the menu from theme appearance settings it simply do not render the menu which hard coded in your tpl file but you can still use menus as blocks. – Fahad Jan 20 '14 at 18:31
  • Thanks Fahad, I really appreciate the assistance, I'll give it a shot. – John Jan 20 '14 at 20:08

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.