I'm developing a custom theme using sub-theme just for learning purpose. In custom theme, I have added a custom block in which I need to display main menus' sub items if in_active_trail. I have already tried many times and wasted a lot time but unsuccessful.

  1. Block should display when Level 1 is in_active_trails and it has child(s).
  2. Block should not display when Level 1 in_active_trails but it has no child.
  3. If any Level 2 is current page, display Level 2 and 3 menu items expect level 1.
  4. Same as point 3, if Level 3 is current page then display level 3 and 2 items.

See attached image below for more understanding what I want to do.

Main Menu hierarchy

enter image description here

1 Answer 1


Here is the solution Menu Block. Install and configure it.

It works for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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