Support » Themes and Templates » Sandbox Menu Depth Level

  • damatthew


    Hi all,

    I’ve been writing a theme based on the Sandbox theme and have been stumped with how the menu function in Sandbox works. I’m trying to make the menu show top level pages only, rather than including sub-page dropdowns, which appears to be the default in Sandbox.

    I thought this would be a relatively straight forward issue by simply adding “depth=1” to the menu function in functions.php, but for some reason when I do that, the sub menus still appear. I’m going to need to add dynamic menu highlighting after this, which is why I’m trying to resolve this issue by editing the function rather than simply using WordPress’s menu widget.

    If anyone has any suggestions, I’m all ears. Thanks!

    The URL of my test site is and the following is the code in question:

    function sandbox_globalnav() {
    	if ( $menu = str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages('depth=1&title_li=1&sort_column=menu_order&echo=0') ) )
    		$menu = '<ul>' . $menu . '</ul>';
    	$menu = '<div id="menu">' . $menu . "</div>\n";
    	echo apply_filters( 'globalnav_menu', $menu ); // Filter to override default globalnav: globalnav_menu
Viewing 1 replies (of 1 total)
  • Couldn’t you just do this with CSS? Maybe create a rule that hides all of the children of the menu?
    .children {display: none;}

Viewing 1 replies (of 1 total)
  • The topic ‘Sandbox Menu Depth Level’ is closed to new replies.