Steve's Navigation menu update from WildBills
authorLaury GvR <laury@gaslightmedia.com>
Fri, 10 Oct 2014 20:55:50 +0000 (16:55 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Fri, 10 Oct 2014 20:55:50 +0000 (16:55 -0400)
footer.php
functions.php
index.php
page-38.php
sidebar.php
style.css

index 4a7d8a7..704434a 100755 (executable)
 <script src="<?php bloginfo('template_url'); ?>/js/vendor/jquery.js"></script>
 <script src="<?php bloginfo('template_url'); ?>/js/foundation.min.js"></script>
 <script>
-jQuery(window).resize( function() {
-    if(jQuery(window).width() <= 640) {
-        jQuery("#logo").attr("src","<?php echo get_template_directory_uri();?>/assets/logo-small2.jpg");
-//        jQuery("#logo").hide();
-    } else {
-        jQuery("#logo").attr("src","<?php echo get_template_directory_uri();?>/assets/logo.gif");
-//        jQuery("#logo").show();
-    }
-});
-jQuery(document).foundation();
+    jQuery(window).resize( function() {
+        if(jQuery(window).width() <= 640) {
+            jQuery("#logo").attr("src","<?php echo get_template_directory_uri();?>/assets/logo-small2.jpg");
+    //        jQuery("#logo").hide();
+        } else {
+            jQuery("#logo").attr("src","<?php echo get_template_directory_uri();?>/assets/logo.gif");
+    //        jQuery("#logo").show();
+        }
+    });
+    jQuery(document).foundation();
+
+    jQuery(document).foundation();
+    jQuery(document).ready(function(){
+    console.log('loading...');
+        jQuery('.off-canvas-list ul.children').before('<a class="toggle" href="#"></a>');
+        jQuery('.off-canvas-list').find('a.toggle').click(function(){
+            jQuery(this).toggleClass('open');
+            jQuery(this).siblings('ul').toggleClass('open');
+        });
+    });
 </script>
index dc3f9a6..e2e43f4 100644 (file)
 
 <?php
+
+if (!function_exists('glmAddSubs')) {
+    $ancestorId   = null;
+    $includePages = array();
+    $frontPageId  = get_option('page_on_front');
+    function glm_wp_list_pages()
+    {
+        global $ancestorId, $includePages, $post;
+        glmAddSubs();
+        glmAddDescendants($post);
+        glmAddParent($post);
+        glmAddSiblings($post);
+        $incl = implode(',', $includePages);
+        wp_list_pages(
+            array(
+                'child_of'    => $ancestorId,
+                'include'     => $incl,
+                'link_before' => '',
+                'title_li'    => '',
+                'sort_column' => 'menu_order'
+            )
+        );
+    }
+    function glmAddSubs()
+    {
+        global $includePages, $post;
+        $pages = get_pages(array('parent' => 0));
+        foreach ($pages as $page) {
+            $includePages[] = $page->ID;
+        }
+    }
+    function glmAddDescendants($glmPost)
+    {
+        global $includePages, $frontPageId, $ancestorId;
+        if ($glmPost->ID != $frontPageId) {
+            $includePages[] = "{$glmPost->ID}";
+            $ancestorId = $glmPost->ID;
+            $descendants = get_pages(array('child_of' => $ancestorId));
+        } else {
+            $ancestorId = $frontPageId;
+        }
+
+        if (isset($descendants) && $descendants) {
+            foreach ($descendants as $page) {
+               if (($page->post_parent == $ancestorId) &&
+                   ($page->post_parent == $glmPost->ID))
+               {
+                    $includePages[] = $page->ID;
+                }
+            }
+        }
+    }
+    function glmAddParent($glmPost)
+    {
+        global $includePages, $frontPageId, $ancestorId;
+        $includePages[] = "{$glmPost->post_parent}";
+        $parents = get_post_ancestors($glmPost->ID);
+        foreach ($parents as $page) {
+            $includePages[] = $page;
+        }
+    }
+    function glmAddSiblings($glmPost)
+    {
+        global $includePages, $frontPageId, $ancestorId;
+        glmAddDescendants(get_post($glmPost->post_parent));
+    }
+}
+
+
 // This theme only works in WP version 3.6 or higher.
 //if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) {
 //     require get_template_directory() . '/inc/back-compat.php';
 //}
-
 // Register all navigation menus
 //require_once('navigation.php');
-//
-//
+
+
 //function register_my_menu() {
-//  register_nav_menu('header-menu',__( 'Header Menu' ));
+//  register_nav_menu('sidenav',__( 'sidenav' ));
 //}
 //add_action( 'init', 'register_my_menu' );
-//
-//
+
+
 //function register_my_menus() {
 //  register_nav_menus(
 //    array(
-//      'header-menu' => __( 'Header Menu' ),
-//      'extra-menu' => __( 'Extra Menu' )
-//    )
+//      'sidenav' => __( 'sidenav' )
+//   )
 //  );
 //}
 //add_action( 'init', 'register_my_menus' );
-//
+
 //wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); 
 //
 //wp_nav_menu( array( 'theme_location' => 'extra-menu', 'container_class' => 'my_extra_menu_class' ) );
-//
-//// Register Navigation Menus
-//function custom_navigation_menus() {
-//
-//     $locations = array(
-//     );
-//     register_nav_menus( $locations );
-//
-//}
-//
-//// Hook into the 'init' action
-//add_action( 'init', 'custom_navigation_menus' );
 
+// Register Navigation Menus
+function custom_navigation_menus() {
+
+       $locations = array(
+       );
+       register_nav_menus( $locations );
+
+}
+
+// Hook into the 'init' action
+add_action( 'init', 'custom_navigation_menus' );
 ?>
\ No newline at end of file
index 888e46e..d1b5827 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,8 @@
                     <?php get_sidebar();?>
                     <aside class="left-off-canvas-menu"> 
                         <ul class="off-canvas-list"> 
-                            <?php wp_nav_menu(array('ParrotsLanding' => 'header-menu', 'menu_class' => 'left'));?>
+                            <?php wp_nav_menu( array( 'theme_location' => 'sidenav' ) ); ?>
+                            <?php // wp_nav_menu(array('ParrotsLanding' => 'sidenav', 'menu_class' => 'left'));?>
                         </ul> 
                         <div id="off-canvas-address" class="vcard">
                             <h2 class="fn org"><?php bloginfo('name');?></h2>
index 0d0720d..52cc13f 100644 (file)
@@ -12,9 +12,8 @@
                             {
                                 echo "<div class=\"breadcrumbs\">";
                                     bcn_display();
-                                echo "</div><br><br>";
+                                echo "</div>";
                             }?>
-                            <br> <br>
                         <div id="toolbox">
                             <?php if(have_posts()) : while(have_posts()): the_post();?>
                             <?php the_content();?>
index 9f8fb9c..9d510b8 100755 (executable)
@@ -1,6 +1,7 @@
                     <div id="column" class="show-for-medium-up medium-2 columns sidebar">
                         <div id="nav">
-                            <?php wp_nav_menu(array('ParrotsLanding' => 'header-menu'));?>
+                            <?php glm_wp_list_pages();?>
+                            <?php // wp_nav_menu( array( 'theme_location' => 'sidenav' ) ); ?>
                         </div>
                         <div id="address" class="vcard">
                             <h2 class="fn org"><?php bloginfo('name');?></h2>
index d5ba5db..a0e40e7 100755 (executable)
--- a/style.css
+++ b/style.css
@@ -203,21 +203,18 @@ h1, h2 {
        }
 /* Main Nav */
 #nav {
-       margin: 5px 5px 30px 10px;
-       }
-#nav ul {
-       margin: 0;
+       margin: 5px 0 30px 0;   
        padding: 0 3px 0 3px;
        list-style-type: none;
        }
-#nav ul li {
+#nav li {
        margin: 0;
        padding: 0;
         background: #00b8ff;
         max-width: 184px;
        zoom: 1;
        }
-#nav ul li a {
+#nav li a {
        display: block;
        padding: 3px 1px 3px 6px;
        font-weight: bold;
@@ -245,10 +242,11 @@ h1, h2 {
 }
 /* Hamburger/Mobile nav */
 #off-canvas-address {
-    background-color: rgba(230, 230, 230, 0.4);
+    background-color: rgba(255, 255, 255, 0.7);
     width: 100%;
     line-height: 120%;
     padding-left: 10px;
+    margin-top: 10px;
 }
 nav.tab-bar {
     background-color: rgba(90, 237, 86, 0.9); /* light green */
@@ -265,14 +263,14 @@ nav.tab-bar {
     background-color: rgba(255, 173, 16, 0.6);
     width: 100%;
 }
-aside.left-off-canvas-menu ul.off-canvas-list li a:hover {
-    background-color: rgba(230, 230, 230, 0.4);
-}
 ul.off-canvas-list li a {
     color: black;
 }
+
+/* menu stuff */
 aside.left-off-canvas-menu {
   background: transparent;
+  background-color: rgba(255, 255, 255, 0.6);
 }
 aside.left-off-canvas-menu ul.off-canvas-list li {
   display: block;
@@ -287,28 +285,65 @@ aside.left-off-canvas-menu ul.off-canvas-list li a {
   border-bottom: 1px solid #b1b3b6;
   background-repeat: no-repeat;
   background-position: 3px 50%;
-  padding-left: 55px;
+  padding-left: 0;
+  /*padding-right: 55px;*/
+}
+aside.left-off-canvas-menu ul.off-canvas-list li a:hover {
+/*  background-color: transparent;
+  color: #f27225;*/
+    background-color: rgba(230, 230, 230, 0.4);
+}
+aside.left-off-canvas-menu ul.off-canvas-list li a.toggle {
+  background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAABUCAYAAADwHnXXAAAAGXR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ZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PmLH3EUAAAKASURBVHja7FpNKERRFH7jJ7KQkiKllGRBSRY2ViR2io2yUpSUhiLJb4QQg7KwsLJQNnZKysJWslB+RokSJdEkURjfae5imsa8d9+777lyTn3d3pt77/veOe+cc++54wuHw4bOkmRoLkyQCTLBv04wxekExQd3jsZfVOf9Aw1CSzto6iXmDQGfJn32gSZVJu4BaiX6Z5r8/gGMKnMSfCdnaFYVWm4NOFHtxWPAowJyNMeI8jADLT7JTJxAhmVeNMkt0/wgx2IOdwI1tPghHMaO0MKz24J3O4uDILmHZtsGwU3gwKtU1w+8S/R/BQY8y8XQYhDNssSQGeDG68XCJHBvod8VMOf5agZaDImQYSa9wNtvLbfWgaMEv+/adCg1BKHFLzT+BPnWr8OClULHVpz7lLtPdVlR98V8Zw9WVyteEbyO8dRB4Fm3PckscAscCufRY08SJS8iW1wCXzoSJNlQvSfxcXWLCTJBJsgEmSATZIJMkAkyQSb4i8InTbqZuApo1crEMS+7ApDNtsVGXisNtgGVQL4RqWFrZeIsYCrqmqpdBToRpFJbTtR1OjCvC8ESoCvO/WagWgeCS0BqnPs+IOD0GY4GI0g3oqlL0KVCOI/3BEGOvrMFC10nDPMDblc0SJ5aaKFfLjBk9yG26oPQHoUQquBnWBxC53plQNCrXDwtQY4kzYjUsN03MbRHoaPFxrPIoWpcJQhyyUbklNNnU/MB2fwvq8EOoNyBY5UC7a44CbSXjeYcyHYY2OkPFUWGOOhR6SQTCsgZYo5xpSaG9kqFeVVJp8jhyhas9MYhkz7JEhmDcvci0OBKoOZNk0oNcmWBCTJBJsgEmaDe8i3AAABaiPID+002AAAAAElFTkSuQmCC');
+  background-repeat: no-repeat;
+  background-position: 50% 3px;
+  width: 40px;
+  height: 100%;
+  position: absolute;
+  right: 0;
+  top: 0;
+  transition: none;
+}
+aside.left-off-canvas-menu ul.off-canvas-list li a.toggle.open {
+  background-position: 50% -40px;
+}
+aside.left-off-canvas-menu ul.off-canvas-list li > ul {
+  display: none;
+}
+aside.left-off-canvas-menu ul.off-canvas-list li > ul li > a {
+  padding-right: 10px;
+  margin-right: 25px;
+  font-size: 16px;
+  line-height: 18px;
+}
+aside.left-off-canvas-menu ul.off-canvas-list li > ul.open {
+  display: block;
 }
 
 /* Navigation link colors and backgrounds */
-#nav ul a:link {color: #032c7e;}
-#nav ul a:visited {color: #032c7e;}
-#nav ul a:hover {color: #032c7e; background: #fffb00;}
-#nav ul a:active {color: #032c7e;}
-.current-menu-item > a,
-.current-menu-ancestor > a,
-.current_page_item > a,
-.current_page_ancestor > a {
+#nav li a:link {color: #032c7e;}
+#nav li a:visited {color: #032c7e;}
+#nav li a:hover {color: #032c7e; background: #fffb00;}
+#nav li a:active {color: #032c7e;}
+#nav .current-menu-item > a,
+#nav .current-menu-ancestor > a,
+#nav .current_page_item > a,
+#nav .current_page_ancestor > a,
+#current {
        color: black !important;
        font-weight: bold;
 }
-#menu-general .current-menu-item > a,
-#menu-general .current-menu-ancestor > a,
-#menu-general .current_page_item > a,
-#menu-general .current_page_ancestor > a {
+#nav .current-menu-item > a,
+#nav .current-menu-ancestor > a,
+#nav .current_page_item > a,
+#nav .current_page_ancestor > a,
+#current {
        color:  rgb(231,215,192)  !important; /* tan */
        font-weight: bold;
 }
+ul, ol, dl {
+    margin-bottom: 0;
+}
 #toolbox li {
     padding-left: 10px;
     list-style-position: inside;
@@ -372,11 +407,6 @@ aside.left-off-canvas-menu ul.off-canvas-list li a {
     min-height: 100px;
 }
 
-#nav {
-        margin-left: 0px;
-        margin-right: 0px;
-}
-
 #wrapper {
         margin-bottom: 30px;
 }