Wp_nav_menu does not show child pages

Hi there,

I’m kinda new Roots theme.
I’ve read the docs and tried google this around, why does wp_nav_menu not show child pages at all?
It’s still vanilla Roots and (almost) vanilla Wordpress, only with the addition of a child page under the Sample page.
Could anyone help?

Thanks

Creating a child page won’t automatically add it to the Primary Navigation menu; you’ll need to go the menus part of the WordPress dashboard to add it.

Oh, what i meant wasn’t adding the child page to the top level menu, cmiiw if I add it in the dashboard, wouldn’t it show the child page as the same level as Home and Sample Page?

I want the child page markup to be shown under the Sample page. Like what it does in the default theme, the markups are generated and shown when hover over the Sample page.

Thanks

You’ll still need to add it to the menu manually or search for a general WordPress solution to the issue. To set a child in the menus dashboard, place the child beneath its parent and drag it to the right. When it snaps into place, indented, it will display as a drop down item. This process should not be repeated on a real child.

Thanks. Never knew that before.
I thought it would be done automatically.

It’s one of those things which never really got resolved when custom menus were first introduced. Menus used to be solely governed by hierarchical relationships, now, in most circumstances, they are governed by the much easier to manage custom menu system.

Some of the code in WordPress and Roots still supports both, which has created a few annoying bugs and WordPress only allows you to automatically add top-level pages, not children, to the menus. I’m sure you’ll be able to find a filter or fix if you search general WordPress resources.