• I’ve read other post about controlling the depth of the menu but it none it looks familiar when I look at the site’s code and I know pretty much nothing about php. This is just a quick change for the a none profit. The code is:

    // menu list
    echo ‘

      ‘;

    // page ids in an array
    $pageids = array(
    “student” => 22,
    “supporter” => 24,
    “blog” => 9,
    “about” => 20,
    “parent” => 41,
    “login” => 49
    );

    // check if parent page
    if(in_array($post->ID,$pageids)) echo get_pagechildren($post->ID);
    // subpage
    else {

    // gets parent pages
    $parents = get_post_ancestors($post->ID);

    // the last element in the array is the parent page
    echo get_pagechildren($parents[count($parents)-1]);
    }

    echo ‘
    ‘;

  • The topic ‘Hide child pages in side bar’ is closed to new replies.