Remove third level navigation items from top menu.
authorLaury GvR <laury@gaslightmedia.com>
Tue, 25 Aug 2015 17:10:01 +0000 (13:10 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 25 Aug 2015 17:10:01 +0000 (13:10 -0400)
functions.php
lib/navigation.php

index 6460e58..7518a97 100644 (file)
@@ -48,7 +48,7 @@ function glm_get_menu_options()
  *
  * Grab the top level pages and their sub pages as the main navigation
  */
-function glm_page_menu($parent = 0, $class = '', $subnav = false, $navImg = null)
+function glm_page_menu($parent = 0, $class = '', $subnav = false, $navImg = null, $depth = 0)
 {
     $menuConfig   = glm_get_menu_options();
     $frontPageId  = get_option('page_on_front');
@@ -71,7 +71,9 @@ function glm_page_menu($parent = 0, $class = '', $subnav = false, $navImg = null
     if ($navImg) {
         echo '<li class="nav-img">' . $navImg . '</li>';
     }
+    echo '<div>' . $depth . '</div>';
     foreach ($pages as $page) {
+        echo '<div style="width:200;height:200px;background-color:red; Then bring back th>' .$depth. '</span>';
         if ($parent == 0) {
             $navImg = get_the_post_thumbnail($page->ID);
         } else {
@@ -87,7 +89,7 @@ function glm_page_menu($parent = 0, $class = '', $subnav = false, $navImg = null
             }
             echo '">'."\n";
             echo '<a href="'.get_permalink($page->ID).'">'.$page->post_title.'</a>'."\n";
-            echo glm_page_menu($page->ID, 'sub-menu dropdown', true, $navImg);
+            echo glm_page_menu($page->ID, 'sub-menu dropdown', true, $navImg, $depth+1);
             echo '</li>'."\n";
         } else {
             echo '<li><a href="'.get_permalink($page->ID).'">'.$page->post_title.'</a></li>'."\n";
@@ -95,6 +97,7 @@ function glm_page_menu($parent = 0, $class = '', $subnav = false, $navImg = null
         ++$elemCount;
     }
     echo '</ul><!-- end -->'."\n";
+            
 }
 
 function SearchFilter($query) {
index 65b1ed7..0b8e71a 100644 (file)
@@ -20,7 +20,7 @@ if ( ! function_exists( 'emmetcounty_top_bar' ) ) {
           'after' => '',                                  // after each link </a>
           'link_before' => '',                            // before each link text
           'link_after' => '',                             // after each link text
-          'depth' => 3,                                   // limit the depth of the nav
+          'depth' => 2,                                   // limit the depth of the nav
           'fallback_cb' => false,                         // fallback function (see below)
           'walker' => new Emmetcounty_Top_Bar_Walker()
       ));