سؤال

I'm making a news theme with sections like "Sports", "Health" etc based on the taxonomy module. The "Section" vocabulary is then used as a main menu with sub-sections as sub-menus. Now, I want the relevant sub-menu (e.g. "Health") to stay open/highlighted when viewing an article that belongs to the section. (Not just when viewing the taxonomy page)

For example, take the Daily Mail "Science" section. This should correspond to my taxonomy term page. The "Science" menu is highlighted:

http://www.dailymail.co.uk/sciencetech/index.html

And here is an article that belongs to the "Science" taxonomy term. The "Science" menu stays hilighted:

http://www.dailymail.co.uk/sciencetech/article-2340714/The-Secret-Life-Cat-What-mischievous-moggies-gets-owners-backs.html

What is the best way to accomplish this in Drupal 7?

هل كانت مفيدة؟

المحلول

You can use the Menu Position module to accomplish this.

After installing:

  1. Visit /admin/structure/menu-position
  2. Click "Add menu position rule"
  3. Select the parent menu item "Sports"
  4. Add a page restriction for "sports/*"

This should keep the "sports" menu link active on the correct pages.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top