Support » Fixing WordPress » Hide Child Links in Header with Sandbox Theme

  • ggunter

    (@ggunter)


    Took some time searching around for a solution to this problem. Many cited solutions out there but none of them contained code in my specific setup. After some tooling around, I decided to try the following:

    in themes/sandbox/functions.php

    the very first line of code should be:

    function sandbox_globalnav() {
    	if ( $menu = str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages('title_li=&sort_column=menu_order&echo=0') ) )

    by adding &depth=1 directly after the echo=0 like:

    function sandbox_globalnav() {
    	if ( $menu = str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages('title_li=&sort_column=menu_order&echo=0&depth=1') ) )

    I was able to suppress the child pages in the header, without limiting access to the child pages from the parent- to view the site change you can go to http://garrisongunter.com and see that when you click on the projects page, there is a list of projects with links. The previous workaround was not useful, you had to have a login to view the projects pages. Glad to have this working.

  • The topic ‘Hide Child Links in Header with Sandbox Theme’ is closed to new replies.