update menu items
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 13 Nov 2014 20:12:30 +0000 (15:12 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 13 Nov 2014 20:12:30 +0000 (15:12 -0500)
new function for the main menu
new function for the off canvas menu
update the logo url

css/styles.css
functions.php
header.php

index dfdfd2a..906ef32 100644 (file)
@@ -52,7 +52,7 @@ a.title-posts {
     color: #ab0020;
 }
 header {
-    background: #fff; 
+    background: #fff;
 }
 span {
     color: #000;
@@ -287,7 +287,7 @@ footer a {
 .left-off-canvas-menu {
     background: #fff;
 }
-ul.left-off-canvas-list {
+div.left-off-canvas-list ul {
     list-style: none;
 }
 .left-off-canvas-list li a {
@@ -300,16 +300,16 @@ ul.left-off-canvas-list {
     color: #fff;
     background: #ab0020;
 }
-.left-off-canvas-list ul.dropdown {
+.left-off-canvas-list ul.children {
     list-style: none;
 }
-.left-off-canvas-list .dropdown li a {
+.left-off-canvas-list .children li a {
     display: block;
     color: #000;
     background: #fff;
     line-height: 250%;
 }
-.left-off-canvas-list .dropdown li a:hover {
+.left-off-canvas-list .children li a:hover {
     color: #fff;
     background: #ab0020;
 }
@@ -408,7 +408,7 @@ aside a {
     color: #ab0020;
 }
 .title_space-b {
- padding-bottom: 15px;   
+ padding-bottom: 15px;
 }
 .left {
     text-align: left !important;
@@ -421,7 +421,7 @@ aside a {
     margin-right: 30px;
 }
 p.caption {
-    font-size: 18px;   
+    font-size: 18px;
 }
 p.in {
     font-family: Arial, sans-serif;
index e2ae5a2..3e0a7c7 100755 (executable)
@@ -1,52 +1,53 @@
 <?php
-function register_my_menu() {
-  register_nav_menu('header-menu',__( 'Header Menu' ));
-}
-add_action( 'init', 'register_my_menu' );
 /**
- * Left top bar
- * http://codex.wordpress.org/Function_Reference/wp_nav_menu
+ * glm_page_menu
+ *
+ * Grab the top level pages and their sub pages as the main navigation
  */
-if ( ! function_exists( 'foundationPress_top_bar_l' ) ) {
-       function foundationPress_top_bar_l() {
-           wp_nav_menu(array( 
-               'container' => false,                           // remove nav container
-               'container_class' => '',                        // class of container
-               'menu' => '',                                   // menu name
-               'menu_class' => 'top-bar-menu left',            // adding custom nav class
-               'theme_location' => '',                // 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' => 5,                                   // limit the depth of the nav
-               'fallback_cb' => false,                         // fallback function (see below)
-               'walker' => new top_bar_walker()
-           ));
-       }
+function glm_page_menu()
+{
+    $frontPageId  = get_option('page_on_front');
+    $parents = array();
+    $pages = get_pages(array(
+        'post_type' => 'page',
+        'parent'    => -1,
+        'number'    => '',
+        'exclude'   => $frontPageId
+    ));
+    echo '<ul class="test">';
+    foreach ($pages as $page) {
+        $childs = get_pages('child_of=' . $page->ID);
+        if (count($childs) > 0) {
+            echo '<li';
+            if (count($childs) > 0) {
+                echo ' class="has-dropdown"';
+            }
+            echo '><a href="'.get_permalink($child->ID).'">'.$page->post_title.'</a>';
+            if (count($childs) > 0) {
+                echo '<ul class="sub-menu dropdown">';
+                foreach ($childs as $child) {
+                    echo '<li><a href="'.get_permalink($child->ID).'">'.$child->post_title.'</a></li>';
+                }
+                echo '</ul>';
+            }
+            echo '</li>';
+        } else {
+            echo '<li><a href="'.get_permalink($page->ID).'">'.$page->post_title.'</a></li>';
+        }
+    }
+    echo '</ul>';
 }
-// Add menu walker
-require_once('library/top-bar_walker.php');
 /**
- * Mobile off-canvas
+ * glm_offcanvas_menu
+ *
+ * Generate the list of pages as nested ul li list
  */
-if ( ! function_exists( 'foundationPress_mobile_off_canvas' ) ) {
-       function foundationPress_mobile_off_canvas() {
-           wp_nav_menu(array( 
-               'container' => false,                           // remove nav container
-               'container_class' => '',                        // class of container
-               'menu' => '',                                   // menu name
-               'menu_class' => 'left-off-canvas-list',              // adding custom nav class
-               'theme_location' => '',        // 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' => 5,                                   // limit the depth of the nav
-               'fallback_cb' => false,                         // fallback function (see below)
-               'walker' => new top_bar_walker()
-           ));
-       }
+function glm_offcanvas_menu()
+{
+    wp_page_menu(array(
+        'depth' => 0,
+        'sort_column' => 'menu_order',
+        'menu_class' => 'left-off-canvas-list'
+    ));
 }
-
 ?>
\ No newline at end of file
index 5fa180d..3379c48 100644 (file)
@@ -23,9 +23,9 @@
             </nav>
         </div>
         <div class="small-6 medium-9"></div>
-    </div> 
+    </div>
     <div class="row">
-        
+
         <div id="social" class="small-12 large-push-10 large-2 columns">
             <div id="icons" class="right">
             <a id="face" href="https://www.facebook.com/pages/Preston-Feather-Building-Centers/113480978684138?sk=photos"><img src="<?php echo get_template_directory_uri(); ?>/assets/facebook_icon.png"></a>
             <a id="icon" href="#"><img src="<?php echo get_template_directory_uri(); ?>/assets/houzz_icon.png"></a>
             </div>
         </div>
-        <a class="small-12 large-pull-8 large-4 columns" href="http://dev53.gaslightmedia.com/~ian/WordPress/"><img src="<?php echo get_template_directory_uri(); ?>/assets/logo.png"></a>
+        <a class="small-12 large-pull-8 large-4 columns" href="<?php bloginfo('url');?>"><img src="<?php echo get_template_directory_uri(); ?>/assets/logo.png"></a>
      </div>
     <div class="row show-for-large-up">
         <div class="large-12 text-center columns">
             <nav class="top-bar" data-topbar role="navigation">
             <section class="top-bar-section">
-                                    <?php foundationPress_top_bar_l(); ?>
-
+                <?php glm_page_menu(); ?>
             </section>
             </nav>
         </div>
@@ -52,7 +51,7 @@
         </section>
     </nav>
         <aside class="left-off-canvas-menu">
-            <?php foundationPress_mobile_off_canvas(); ?>
+            <?php glm_offcanvas_menu(); ?>
         </aside>
     </header>
-    
+