logo added to topbar
authorIan Weller <ian@gaslightmedia.com>
Tue, 8 Sep 2015 13:18:03 +0000 (09:18 -0400)
committerIan Weller <ian@gaslightmedia.com>
Tue, 8 Sep 2015 13:18:03 +0000 (09:18 -0400)
functions.php
parts/top-bar.php

index 1f5df9d..e24300a 100644 (file)
@@ -40,7 +40,7 @@ function glm_get_menu_options()
     return $menu_options;
 }
 
-
+/**
 register_nav_menus(array(
   'top-bar' => 'Site Navigation',
   //'mobile-off-canvas' => 'Mobile',
@@ -52,7 +52,7 @@ if ( ! function_exists( 'michsci_top_bar' ) ) {
       wp_nav_menu(array(
           'container' => false,                           // remove nav container
           'container_class' => '',                        // class of container
-          'items_wrap' => '<ul><li id="logo"><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/assets/michigan-scientific-logo.png"></a></li>%3$s<li id="search-icon"><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/assets/Untitled-2.png"></a></li></ul>',
+          'items_wrap' => '<ul><li id="logo"><a href="'.get_bloginfo('url')'"><img src="'.get_bloginfo('template_url').'/assets/michigan-scientific-logo.png"></a></li>%3$s<li id="search-icon"><a href="#"><img src="'.get_bloginfo('template_url').'/assets/Untitled-2.png"></a></li></ul>',
           'menu' => '',                                   // menu name
           'menu_class' => '',                             // adding custom nav class
           'theme_location' => 'top-bar',                  // where it's located in the theme
@@ -81,7 +81,7 @@ class MichiganSci_Top_Bar_Walker extends Walker_Nav_Menu {
        }
 }
 endif;
-    
+*/    
 /**
  * glm_page_menu
  *
@@ -106,7 +106,9 @@ function glm_page_menu($parent = 0, $class = '')
     }
     $pages = get_pages($args);
     echo '<ul'.(($class)?' class="'.$class.'"':'').'><!-- begin -->'."\n";
+    $mainPageCount = 1;
     foreach ($pages as $page) {
+        // echo '<pre>'.print_r($page,true).'</pre>';exit;
         $childs = get_pages('child_of=' . $page->ID);
         if (count($childs) > 0) {
             echo '<li class="has-dropdown">'."\n";
@@ -116,6 +118,19 @@ function glm_page_menu($parent = 0, $class = '')
         } else {
             echo '<li><a href="'.get_permalink($page->ID).'">'.$page->post_title.'</a></li>'."\n";
         }
+        if ($page->post_parent == 0) {
+            if ($mainPageCount == 0) {
+                echo '<li id="logo"><a href="';
+                echo get_bloginfo('url');
+                echo '"><img src="'.get_bloginfo('template_url').'/assets/michigan-scientific-logo.png"></a></li>'."\n";
+            }
+            if ($mainPageCount == 6) {
+                echo '<li id="search-icon"><a href="';
+                echo '#';
+                echo '"><img src="'.get_bloginfo('template_url').'/assets/Untitled-2.png"></a></li>'."\n";
+            }
+            ++$mainPageCount;
+        }
     }
     echo '</ul><!-- end -->'."\n";
 }
index 23e9429..d154377 100644 (file)
@@ -1,6 +1,6 @@
 <nav class="top-bar text-center show-for-large-up" data-topbar role="navigation">
     <section class="top-bar-section">
-        <?php michsci_top_bar(); ?>
+        <?php glm_page_menu(); ?>
     </section>
 </nav>
 <nav class="tab-bar show-for-medium-down">