Off-canvas menu showing blog categories, and still showing arrows.
authorLaury GvR <laury@gaslightmedia.com>
Fri, 28 Aug 2015 13:57:15 +0000 (09:57 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Fri, 28 Aug 2015 13:57:15 +0000 (09:57 -0400)
functions.php

index fd7663b..63d8f8b 100644 (file)
@@ -121,21 +121,11 @@ add_filter('pre_get_posts','SearchFilter');
  *
  * Generate the list of pages as nested ul li list
  */
-//function glm_offcanvas_menu($parent = 0, $class = '')
-//{
-//    $frontPageId  = get_option('page_on_front');
-//    $parents      = array();
-////    $args         = array(
-////        'post_type'   => 'page',
-////        'parent'      => $parent,
-////        'number'      => '',
-////        'exclude'     => $frontPageId,
-////        'post_status' => 'publish',
-////        'sort_order'  => 'asc',
-////        'sort_column' => 'menu_order'
-////    );
-////    $pages = get_pages($args);
-//    $pages = get_pages(array(
+function glm_offcanvas_menu($parent = 0, $class = '')
+{
+    $frontPageId  = get_option('page_on_front');
+    $parents      = array();
+//    $args         = array(
 //        'post_type'   => 'page',
 //        'parent'      => $parent,
 //        'number'      => '',
@@ -143,29 +133,39 @@ add_filter('pre_get_posts','SearchFilter');
 //        'post_status' => 'publish',
 //        'sort_order'  => 'asc',
 //        'sort_column' => 'menu_order'
-//    ));
-//    echo '<ul'.(($class)?' class="'.$class.'"':'').'><!-- begin -->'."\n";
-//    foreach ($pages as $page) {
-//        $childs = get_pages('child_of=' . $page->ID);
-//        if (count($childs) > 0) {   
-//            echo '<li class="page_item page-item-'.$page->ID.' page_item_has_children">'."\n";
-//            echo '<a href="'.get_permalink($page->ID).'">'.$page->post_title.'</a>'."\n";
-//            echo glm_page_menu($page->ID, 'children');
-//            echo '</li>'."\n";
-//        } else if ($page == get_page_by_title('News Articles')) {
-//            echo '<li class="page_item page_item-'.$page->ID.'"><a href="'.get_permalink($page->ID).'">'.$page->post_title.'</a></li>'."\n";
-//            echo wp_list_categories('title_li=' . __(' News Categories:'));
-//        } else {
-//            echo '<li class="page_item page_item-'.$page->ID.'"><a href="'.get_permalink($page->ID).'">'.$page->post_title.'</a></li>'."\n";
-//        }
-//    }
-//    echo '</ul><!-- end -->'."\n";
-function glm_offcanvas_menu() {
-    wp_page_menu(array(
-        'depth' => 0,
-        'sort_column' => 'menu_order',
-        'menu_class' => 'left-off-canvas-list'
+//    );
+//    $pages = get_pages($args);
+    $pages = get_pages(array(
+        'post_type'   => 'page',
+        'parent'      => $parent,
+        'number'      => '',
+        'exclude'     => $frontPageId,
+        'post_status' => 'publish',
+        'sort_order'  => 'asc',
+        'sort_column' => 'menu_order'
     ));
+    echo '<ul'.(($class)?' class="'.$class.'"':'').'><!-- begin -->'."\n";
+    foreach ($pages as $page) {
+        $childs = get_pages('child_of=' . $page->ID);
+        if (count($childs) > 0) {   
+            echo '<li class="page_item page-item-'.$page->ID.' page_item_has_children">'."\n";
+            echo '<a href="'.get_permalink($page->ID).'">'.$page->post_title.'</a>'."\n";
+            echo glm_offcanvas_menu($page->ID, 'children');
+            echo '</li>'."\n";
+        } else if ($page == get_page_by_title('News Articles')) {
+            echo '<li class="page_item page_item-'.$page->ID.'"><a href="'.get_permalink($page->ID).'">'.$page->post_title.'</a></li>'."\n";
+            echo wp_list_categories('title_li=' . __(' News Categories:'));
+        } else {
+            echo '<li class="page_item page_item-'.$page->ID.'"><a href="'.get_permalink($page->ID).'">'.$page->post_title.'</a></li>'."\n";
+        }
+    }
+    echo '</ul><!-- end -->'."\n";
+//function glm_offcanvas_menu() {
+//    wp_page_menu(array(
+//        'depth' => 0,
+//        'sort_column' => 'menu_order',
+//        'menu_class' => 'left-off-canvas-list'
+//    ));
 }
 
 add_theme_support('post-thumbnails');