WordPress.org

Ready to get started?Download WordPress

Forums

Hide Child Links in Header with Sandbox Theme (1 post)

  1. ggunter
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by ggunter
  • This topic is not a support question
  • WordPress version: 2.8