Update this again
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 20 Dec 2017 19:32:42 +0000 (14:32 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 20 Dec 2017 19:32:42 +0000 (14:32 -0500)
reversing hom I'm getting pages. Now trying to get list of bad pages and
then pass to exclude.

functions.php

index d9892c7..5634d44 100644 (file)
@@ -49,8 +49,8 @@ function glm_page_menu($parent = 0, $class = '')
         'post_type'   => 'page',
         'parent'      => $parent,
         'number'      => '',
-        'exclude'     => "$frontPageId,702",
-        'include'     => glm_get_visable_page_ids(),
+        'exclude'     => "$frontPageId,702,".glm_get_notvisable_page_ids(),
+        'include'     => '',
         'post_status' => 'publish',
         'sort_order'  => 'asc',
         'sort_column' => 'menu_order'
@@ -96,7 +96,7 @@ function SearchFilter($query) {
 }
 add_filter('pre_get_posts','SearchFilter');
 
-function glm_get_visable_page_ids()
+function glm_get_notvisable_page_ids()
 {
     static $publishPageIds = array();
     //return implode( ',', $publishPageIds );
@@ -104,15 +104,13 @@ function glm_get_visable_page_ids()
         // Find all pages marked published
         $publishedPages = get_pages(
             array(
-                'post_type'     => 'page',
-                'post_status'   => 'publish',
-                'sort_order'    => 'asc',
-                'sort_column' => 'menu_order'
+                'post_type'   => 'page',
+                'post_status' => 'publish',
             )
         );
     if ( $publishedPages ) {
             foreach ( $publishedPages as $page ) {
-                if ( !$page->post_password ) {
+                if ( $page->post_password ) {
                     $publishPageIds[] = $page->ID;
                 }
             }
@@ -134,7 +132,7 @@ function glm_offcanvas_menu()
         'depth'       => 0,
         'sort_column' => 'menu_order',
         'menu_class'  => 'left-off-canvas-list',
-        'include'     => glm_get_visable_page_ids(),
+        'exclude'     => glm_get_notvisable_page_ids(),
     ));
 }