testing dropdown for quick links
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 11 Jan 2016 19:37:01 +0000 (14:37 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 11 Jan 2016 19:37:01 +0000 (14:37 -0500)
js/app.js
js/custom/pageSetup.js
lib/navigation.php
nav-menu-dropdown.php [new file with mode: 0644]
parts/frontpage-sidebar-dropdown.php [new file with mode: 0644]
sidebar.php

index fc834ad..e44f446 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -71,7 +71,7 @@ $(document).ready(function () {
     
     // adjusting nav menu columns and li width
     $menu1
-        .css("max-height", "235px");
+        .css("max-height", "250px");
     $menu2
         .css("-moz-columns", "2")
         .css("-webkit-columns", "2")
@@ -115,10 +115,6 @@ $(document).ready(function () {
             });
         }
     }
-    
-//    alert(words.length);
-//    var words = $('div[class*="excerpt"])').text().split(' ');
-//    alert(words.length);
    /* get number of elements in DOM console.log($("*").length);
     var pageBytes = $('html').html().length;
     var kbytes = pageBytes / 1024;
index 5813751..c31f81f 100644 (file)
@@ -62,7 +62,7 @@ $(document).ready(function () {
     
     // adjusting nav menu columns and li width
     $menu1
-        .css("max-height", "235px");
+        .css("max-height", "250px");
     $menu2
         .css("-moz-columns", "2")
         .css("-webkit-columns", "2")
@@ -106,10 +106,6 @@ $(document).ready(function () {
             });
         }
     }
-    
-//    alert(words.length);
-//    var words = $('div[class*="excerpt"])').text().split(' ');
-//    alert(words.length);
    /* get number of elements in DOM console.log($("*").length);
     var pageBytes = $('html').html().length;
     var kbytes = pageBytes / 1024;
index 7e780ae..0f28bb0 100644 (file)
@@ -6,7 +6,8 @@ register_nav_menus(array(
   'top-bar-3' => 'Top Nav Three',
   'top-bar-4' => 'Top Nav Four',
   'top-bar-5' => 'Top Nav Five',
-  'top-bar-6' => 'Top Nav Six'
+  'top-bar-6' => 'Top Nav Six',
+  'frontpage-sidebar' => 'Quick Links'
 ));
 
 /**
diff --git a/nav-menu-dropdown.php b/nav-menu-dropdown.php
new file mode 100644 (file)
index 0000000..10597e5
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Nav Menu Dropdown
+ *
+ * @package      BE_Genesis_Child
+ * @since        1.0.0
+ * @link         https://github.com/billerickson/BE-Genesis-Child
+ * @author       Bill Erickson <bill@billerickson.net>
+ * @copyright    Copyright (c) 2011, Bill Erickson
+ * @license      http://opensource.org/licenses/gpl-2.0.php GNU Public License
+ *
+ */
+
+class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu {
+    function start_lvl( &$output, $depth = 0, $args = array() ){
+        $indent = str_repeat("\t", $depth); // don't output children opening tag (`<ul>`)
+    }
+
+    function end_lvl( &$output, $depth = 0, $args = array() ){
+        $indent = str_repeat("\t", $depth); // don't output children closing tag
+    }
+
+    /**
+    * Start the element output.
+    *
+    * @param  string $output Passed by reference. Used to append additional content.
+    * @param  object $item   Menu item data object.
+    * @param  int $depth     Depth of menu item. May be used for padding.
+    * @param  array $args    Additional strings.
+    * @return void
+    */
+    function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0) {
+        $url = '#' !== $item->url ? $item->url : '';
+        $output .= '<option value="' . $url . '">' . $item->title;
+    }
+
+    function end_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0){
+        $output .= "</option>\n"; // replace closing </li> with the option tag
+    }
+}
diff --git a/parts/frontpage-sidebar-dropdown.php b/parts/frontpage-sidebar-dropdown.php
new file mode 100644 (file)
index 0000000..8dec241
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+// Nav Menu Dropdown Class
+include_once( 'nav-menu-dropdown.php' );
+
+wp_nav_menu( array(
+    'theme_location' => 'frontpage-sidebar',
+    'menu'           => 'frontpage-sidebar',
+    'walker'         => new Walker_Nav_Menu_Dropdown(),
+    'items_wrap'     => '<div class="mobile-menu"><form><select onchange="if (this.value) window.location.href=this.value"><option value="" selected="selected" disabled="true" selected>-- select a service</option>%3$s</select></form></div>',
+) );
+?>
\ No newline at end of file
index e716035..947a59f 100644 (file)
@@ -4,6 +4,11 @@
                         <?php echo do_shortcode('[ai1ec view="stream" events_limit="3"]'); ?>
                         <a id="event-link" href="<?php bloginfo('url'); ?>/events">View All Events</a>
                         <h2>Quick Links</h2>
+                        <form class="side-quick-links">
+                            <label for="frontpage-sidebar"></label>
+                            <?php get_template_part("parts/frontpage-sidebar-dropdown") ?>
+                        </form>
+<!--
                         <form class="side-quick-links">
                             <select>
                                 <option value="1">Select</option>
@@ -13,6 +18,7 @@
                             </select>
                             <input type="submit" value="Go">
                         </form>
+-->
                     </div>