added nav menu for header links, added navigation conditional to separate menus
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 14 Mar 2016 13:13:45 +0000 (09:13 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 14 Mar 2016 13:13:45 +0000 (09:13 -0400)
header.php
index.php
lib/navigation.php
scss/_blog.scss

index f873a16..2ccd5bf 100644 (file)
                             <a id="small-lens" href="http://discoverkzoo.DiscoverKalamazoo.com" target="_blank">#DiscoverKZoo</a>
                         </div>
                         <div class="large-8 columns">
+                           
                             <ul>
+                            <li id="searchIcon"><a><img src="<?php bloginfo('template_url'); ?>/assets/search-icon.jpg"></a></li>
+                                <li><?php get_template_part("parts/search"); ?></li>
+<!--
                                 <li><a href="<?php bloginfo('url')?>">Home</a></li>
                                 <li><a href="<?php echo get_permalink(3200);?>">Meetings & Events</a></li>
                                 <li><a  href="<?php echo get_permalink(3201);?>"> Sports Planning</a></li>
                                 <li><a  href="<?php echo get_permalink(3202);?>">Travel Partners</a></li>
                                 <li><a  href="<?php echo get_permalink(3203);?>">Media</a></li>
                                 <li><a href="<?php echo get_permalink(3328); ?>">Blog</a></li>
-                                <li id="searchIcon"><a><img src="<?php bloginfo('template_url'); ?>/assets/search-icon.jpg"></a></li>
-                                <li><?php get_template_part("parts/search"); ?></li>
+-->
                             </ul>
+                            <?php glm_theme_top_links(); ?>
                         </div>
                     </div>
                 </header>
index da2a5cc..1d70b92 100644 (file)
--- a/index.php
+++ b/index.php
@@ -15,7 +15,7 @@
     <div id="addthis_wrapper">
         <!-- AddThis Button BEGIN -->
         <div class="addthis_toolbox addthis_default_style ">
-        <a class="addthis_counter addthis_pill_style"></a>
+        <a id="addThisPill" class="addthis_counter addthis_pill_style"></a>
     </div>
     <script type="text/javascript">var addthis_config = {"data_track_addressbar":false};</script>
     <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5135fe4558d287a9"></script>
index f30080c..2987f7c 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 register_nav_menus(array(
-  'top-bar' => 'Site Navigation',
+    'top-bar' => 'Site Navigation',
     'top-links' => 'Header Links'
 ));
 
@@ -26,6 +26,24 @@ if ( ! function_exists( 'glm_theme_top_bar' ) ) {
       ));
   }
 }
+if ( ! function_exists( 'glm_theme_top_links' ) ) {
+  function glm_theme_top_links() {
+      wp_nav_menu(array(
+          'container' => false,                           // remove nav container
+          'container_class' => '',                        // class of container
+          'menu' => '',                                   // menu name
+          'menu_class' => '',                             // adding custom nav class
+          'theme_location' => 'top-links',                // where it's located in the theme
+          'before' => '',                                 // before each link <a>
+          'after' => '',                                  // after each link </a>
+          'link_before' => '',                            // before each link text
+          'link_after' => '',                             // after each link text
+          'depth' => 1,                                   // limit the depth of the nav
+          'fallback_cb' => false,                         // fallback function (see below)
+          'walker' => new Glm_Theme_Top_Bar_Walker()
+      ));
+  }
+}
 
 /**
  * Mobile off-canvas
@@ -167,12 +185,17 @@ function glm_get_menu_options()
 
 function glm_side_menu($mobile = false) {
     global $post;
-    // do not use appearance menu for the following page ID's or their ancestors
+    $sideMenu = $allMenu = $pageMenuId = array();
+//     do not use appearance menu for the following page ID's or their ancestors
     if( !is_page(array(3200, 3201,3202,3203)) && !is_tree(3200) && !is_tree(3201) && !is_tree(3202) && !is_tree(3203)) {
-        $sideMenu = $allMenu = $pageMenuId = array();
         if (($locations = get_nav_menu_locations()) && isset($locations['top-bar'])) {
-            $menu       = wp_get_nav_menu_object($locations['top-bar']);
+                $menu       = wp_get_nav_menu_object($locations['top-bar']);
+            }
+    } else {
+        if (($locations = get_nav_menu_locations()) && isset($locations['top-links'])) {
+            $menu       = wp_get_nav_menu_object($locations['top-links']);
         }
+    }
         $menu_items = wp_get_nav_menu_items($menu->term_id);
         foreach ((array) $menu_items as $key => $menu_item) {
             $sideMenu[$menu_item->menu_item_parent][] = $menu_item;
@@ -243,21 +266,21 @@ function glm_side_menu($mobile = false) {
         }
         echo '</ul>';
         // using page menu here for the listed page ID's above
-    } else {
-
-        $parents = get_post_ancestors($post->ID);
-        $id = ($parents) ? $parents[count($parents)-1]: $post->ID;
-        $parent = get_page( $id );
-        if ($id == 0) {
-            $ID = $post->ID;
-        } else {
-            $ID = $parent->ID;
-        }
-        echo '<h2>'.get_the_title($ID).'</h2>';
-        echo '<ul class="sidebar"><!-- begin -->'."\n";
-        echo wp_list_pages( 'child_of='.$ID.'&title_li=&depth=1&echo=0');
-        echo '</ul><!-- end -->'."\n";
-    }
+//    } else {
+//
+//        $parents = get_post_ancestors($post->ID);
+//        $id = ($parents) ? $parents[count($parents)-1]: $post->ID;
+//        $parent = get_page( $id );
+//        if ($id == 0) {
+//            $ID = $post->ID;
+//        } else {
+//            $ID = $parent->ID;
+//        }
+//        echo '<h2>'.get_the_title($ID).'</h2>';
+//        echo '<ul class="sidebar"><!-- begin -->'."\n";
+//        echo wp_list_pages( 'child_of='.$ID.'&title_li=&depth=1&echo=0');
+//        echo '</ul><!-- end -->'."\n";
+//    }
 }
 
 
index a7963ae..cdc483c 100644 (file)
@@ -232,4 +232,4 @@ article {
 }
 .addthis_counter.addthis_pill_style{
     float: right;
-}
\ No newline at end of file
+}