Developing my own theme and I don't understand why my primary menu is listing all of my pages on a parent level, when I want only 5 parent pages as my menu with each having child pages in sub-nav that appears on hover or click.

My page structure looks something like:

  1. Home (parent)
  2. Services (parent)
    - service#1 (child)
    - service#2 (child)
    - service#2 (child)
  3. Company (parent)
    - company#1 (child)
    - company#2 (child)
    - company#3 (child)

Those child pages should not be shown in the menu until its parent page is hovered or clicked on. Yet, this seems to be the default position in wordpress (parent and child showing at same level in menu)?

Any help? Thanks.

  • So I figured out that it had to do with the "depth" attribute in the nav_menu. However, I still don't understand how to get the child pages to show on hover or click of parent. – lemonsevens15 Mar 18 '15 at 2:29
  • It's a CSS issue. Better search how dropdown menu can be made with CSS. I'm afraid it's not related to WordPress and an off-topic here. – Mayeenul Islam Mar 18 '15 at 3:05
  • @MayeenulIslam Custom walkers is on topic here. This can be alternatively be done with CSS. Keeping this open – Pieter Goosen Mar 18 '15 at 4:24
  • Yeah, there is definitely a custom walker issue I believe. Totally foreign to me. How could this alternatively be done in CSS? – lemonsevens15 Mar 18 '15 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.