Example #1
0

	<div class="nestedpages">
		<?php 
$this->loopPages();
?>
		
		<div class="quick-edit quick-edit-form" style="display:none;">
			<?php 
include NP_Helpers::view('quickedit');
?>
		</div>

		<?php 
if (current_user_can('publish_pages')) {
    ?>
		<div class="quick-edit quick-edit-form-redirect" style="display:none;">
			<?php 
    include NP_Helpers::view('quickedit-redirect');
    ?>
		</div>
		<?php 
}
?>
	</div>

</div><!-- .wrap -->

<?php 
include NP_Helpers::view('link-form');
 /**
  * Display the Settings Page
  */
 public function settingsPage()
 {
     $this->setMenu();
     include NP_Helpers::view('settings');
 }
 /**
  * Format the new link for AJAX response
  */
 private function formatLink()
 {
     $this->data['np_link_content'] = NP_Helpers::check_url($this->data['np_link_content']);
 }
 /**
  * Sync Link Menu Item
  * @since 1.1.4
  */
 private function syncLinkItem($menu_parent)
 {
     $menu = wp_update_nav_menu_item($this->id, 0, array('menu-item-title' => $this->post['nav_title'], 'menu-item-url' => NP_Helpers::check_url(get_the_content($this->post['ID'])), 'menu-item-attr-title' => $this->post['title_attribute'], 'menu-item-status' => 'publish', 'menu-item-classes' => $this->post['css_classes'], 'menu-item-type' => 'custom', 'menu-item-object' => 'page', 'menu-item-object-id' => $this->post['ID'], 'menu-item-parent-id' => $menu_parent, 'menu-item-target' => $this->post['link_target']));
 }
Example #5
0
			<a href="#" 
				class="np-btn np-quick-edit-redirect" 
				data-id="<?php 
echo get_the_id();
?>
" 
				data-parentid="<?php 
echo $this->post_data['parent_id'];
?>
"
				data-title="<?php 
the_title();
?>
" 
				data-url="<?php 
echo NP_Helpers::check_url(get_the_content());
?>
"
				data-status="<?php 
echo get_post_status();
?>
" 
				data-np-status="<?php 
echo $this->post_data['np_status'];
?>
"
				data-navstatus="<?php 
echo $this->post_data['nav_status'];
?>
"
				data-navtitleattr="<?php 
 /**
  * Loop through all the pages and create the nested / sortable list
  * Recursive Method, called in page.php view
  */
 private function loopPages($parent_id = 0, $count = 0)
 {
     $this->setTaxonomies();
     $pages = new WP_Query(array('post_type' => array('page', 'np-redirect'), 'posts_per_page' => -1, 'orderby' => 'menu_order', 'post_status' => array('publish', 'pending', 'draft', 'private', 'future', 'trash'), 'post_parent' => $parent_id, 'order' => 'ASC'));
     if ($pages->have_posts()) {
         $count++;
         if ($this->publishCount($pages) > 1) {
             $this->listOpening($pages, $count);
         }
         while ($pages->have_posts()) {
             $pages->the_post();
             global $post;
             $this->setPostData($post);
             if (get_post_status(get_the_id()) !== 'trash') {
                 echo '<li id="menuItem_' . get_the_id() . '" class="page-row';
                 // Published?
                 if ($post->post_status == 'publish') {
                     echo ' published';
                 }
                 // Hidden in Nested Pages?
                 if ($this->post_data['np_status'] == 'hide') {
                     echo ' np-hide';
                 }
                 // Taxonomies
                 echo ' ' . $this->hierarchicalTaxonomies(get_the_id());
                 echo ' ' . $this->flatTaxonomies(get_the_id());
                 echo '">';
                 $count++;
                 if (get_post_type() == 'page') {
                     include NP_Helpers::view('row');
                 } else {
                     include NP_Helpers::view('row-redirect');
                 }
             }
             // trash status
             $this->loopPages(get_the_id(), $count);
             if (get_post_status(get_the_id()) !== 'trash') {
                 echo '</li>';
             }
         }
         // Loop
         if ($this->publishCount($pages) > 1) {
             echo '</ol>';
         }
     }
     wp_reset_postdata();
 }