Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

This other SO post says that Context provides this functionality out of the box, but when I add settings which seem reasonable, the active and/or active-trail classes are not set on my menu items.

How am I supposed to configure Context to set the active and/or active-trail on my menu items?

Here is my set up:

I've added some terms to the standard Tags taxonomy. For example: Surf, Skate, Volleyball.

I've used Pathauto to set dynamic paths for my taxonomy terms. blog/Surf, blog/Skate, etc.

I created a Menu with an item called Surf with a path of blog/Surf, as well as for Skate and Volleyball, etc.

I added that menu to the Highlighted region of my site.

When I browse to blog/Surf, my menu item does not receive the active nor the active-trail class so that I can style it appropriately to show the user that is where they currently are in the site.

I tried creating a Context for it and guessing at how it should be configured.

How do I get the active and/or active-trail classes on my blog/Surf menu item?

enter image description here

share|improve this question
Have you tried adding a "Debug" reaction? Does it say in message area "Active context: X" when you're viewing a node tagged with "Surf" term? – Beebee Jan 2 at 10:24

1 Answer

The only reason I can think of is that the context modules is actually adding the trail classes but the theme that you are using is not using them.

You can verify this in two ways,

  1. Change the theme back to Bartik and see if it works.
  2. Checkout the template file of your theme, print the variables that are passed to theme_menu_item in your template.php file

If the problem is your theme, then you will need to override the theme_menu_item accordingly in your theme.

share|improve this answer
1  
I'm using a Zen theme, but I tried switching to Bartik anyway and that doesn't change anything. The Surf menu item does not get the active and/or active-trail classes. – Kenny Wyland Jan 1 at 20:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.