Work on dev55 to get it working
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 20 Dec 2017 19:15:27 +0000 (14:15 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 20 Dec 2017 19:15:27 +0000 (14:15 -0500)
wierdness on dev55

functions.php

index 101ebbf..cbb83c3 100644 (file)
@@ -99,21 +99,27 @@ add_filter('pre_get_posts','SearchFilter');
 function glm_get_visable_page_ids()
 {
     static $publishPageIds = array();
+    //return implode( ',', $publishPageIds );
     if ( empty( $publishPageIds ) ) {
         // Find all pages marked published
         $publishedPages = get_pages(
             array(
                 'post_type'     => 'page',
                 'post_status'   => 'publish',
+               'sort_order'    => 'asc',
             )
         );
-        foreach ( $publishedPages as $page ) {
-            if ( !$page->post_password ) {
-                $publishPageIds[] = $page->ID;
+       if ( $publishedPages ) {
+            foreach ( $publishedPages as $page ) {
+                if ( !$page->post_password ) {
+                    $publishPageIds[] = $page->ID;
+                }
             }
         }
+        return implode( ',', $publishPageIds );
+    } else {
+       return '';
     }
-    return $publishPageIds;
 }
 
 /**