/** * Loop through all the pages and create the nested / sortable list * Recursive Method, called in page.php view */ private function loopPosts($parent_id = 0, $count = 0) { $this->setTaxonomies(); if ($this->post_type->name == 'page') { $post_type = array('page'); if (!$this->settings->menusDisabled()) { $post_type[] = 'np-redirect'; } } else { $post_type = array($this->post_type->name); $post_type[] = 'np-redirect'; } $query_args = array('post_type' => $post_type, 'posts_per_page' => -1, 'author' => $this->sort_options->author, 'orderby' => $this->sort_options->orderby, 'post_status' => array('publish', 'pending', 'draft', 'private', 'future', 'trash'), 'post_parent' => $parent_id, 'order' => $this->sort_options->order); if ($this->isSearch()) { $query_args = $this->searchParams($query_args); } if ($this->isFiltered()) { $query_args = $this->filterParams($query_args); } $pages = new \WP_Query(apply_filters('nestedpages_page_listing', $query_args)); if ($pages->have_posts()) { $count++; if ($this->publishCount($pages) > 1) { $this->listOpening($pages, $count); } while ($pages->have_posts()) { $pages->the_post(); global $post; $this->setPost($post); if ($this->post->status !== 'trash') { echo '<li id="menuItem_' . $this->post->id . '" class="page-row'; // Published? if ($this->post->status == 'publish') { echo ' published'; } if ($this->post->status == 'draft') { echo ' draft'; } // Hidden in Nested Pages? if ($this->post->np_status == 'hide') { echo ' np-hide'; } // Taxonomies echo ' ' . $this->post_repo->getTaxonomyCSS($this->post->id, $this->h_taxonomies); echo ' ' . $this->post_repo->getTaxonomyCSS($this->post->id, $this->f_taxonomies, false); echo '">'; $count++; $row_view = $this->post->type !== 'np-redirect' ? 'partials/row' : 'partials/row-link'; include Helpers::view($row_view); } // trash status if (!$this->isSearch()) { $this->loopPosts($this->post->id, $count); } if ($this->post->status !== 'trash') { echo '</li>'; } } // Loop if ($this->publishCount($pages) > 1) { echo '</ol>'; } } wp_reset_postdata(); }
/** * Display the Settings Page * Callback for registerSettingsPage method */ public function settingsPage() { $this->setMenu(); $tab = isset($_GET['tab']) ? $_GET['tab'] : 'general'; include Helpers::view('settings/settings'); }