Admin Menu Tree Page View (CMS)

Admin Menu Tree Page View

The Admin Menu Tree Page View plugin adds a tree-view layout to your pages - directly accessible in the admin menu. This way, all your content will be available with just one click, no matter where you are in the admin area.

You can also add pages directly in the tree and you can quickly find your pages by using the real-time search box.

Thanks for using my plugin!

Hi there! Thanks for using my plugin. I hope you like it as much as I do.

— Ciprian Popescu - plugin creator

I like this plugin - how can I thank you?

There are several ways for you to show your appreciation:

  1. Give it a nice review over at the WordPress Plugin Directory
  2. Give a donation - any amount will make me happy
  3. Post a nice tweet or write a nice blog post about the plugin

Support

Please see the support forum for help.

Homepage More WordPress plugins ☕ Buy me a coffee true, ]; $output = 'objects'; $operator = 'and'; $post_types = get_post_types( $args, $output, $operator ); unset( $post_types['attachment'] ); ?>

'; foreach ( $post_types as $post_type ) { echo ''; } echo '

  • 0, 'sort_order' => 'ASC', 'sort_column' => 'menu_order', 'parent' => 0, ]; echo admin_menu_tree_page_view_get_content( $args, $selected_post_type ); ?>

$post_type, 'parent' => 0, 'post_parent' => 0, 'numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_status' => 'any', 'suppress_filters' => true, // 0 is supposed to fix problems with WPML, but we want to keep it true to avoid caching ]; $args = wp_parse_args( $args, $defaults ); // Contains all page IDs as keys and their parent as the value $arr_all_pages_id_parent = amtpv_get_all_pages_id_parent(); $pages = get_posts( $args ); $output = ''; $str_child_output = ''; foreach ( $pages as $one_page ) { $edit_link = get_edit_post_link( $one_page->ID ); $title = get_the_title( $one_page->ID ); $title = esc_html( $title ); // add num of children to the title // @done: this is still being done for each page, even if it does not have children. can we check if it has before? // we could fetch all pages once and store them in an array and then just check if the array has our id in it. yeah. let's do that. // if our page id exists in $arr_all_pages_id_parent and has a value // so result is from 690 queries > 474 = 216 queries less. still many.. // from 474 to 259 = 215 less // so total from 690 to 259 = 431 queries less! grrroooovy if ( in_array( $one_page->ID, $arr_all_pages_id_parent ) ) { $post_children = get_children( [ 'post_parent' => $one_page->ID, 'post_type' => $post_type, ] ); $post_children_count = sizeof( $post_children ); $title .= " ($post_children_count)"; } else { $post_children_count = 0; } $class = ''; if ( isset( $_GET['action'] ) && (string) $_GET['action'] === 'edit' && isset( $_GET['post'] ) && (int) $_GET['post'] === $one_page->ID ) { $class = 'current'; } $status_span = ''; if ( $one_page->post_password ) { $status_span .= ''; } if ( (string) $one_page->post_status !== 'publish' ) { $status_span .= "" . sprintf( __( '%s' ), ucfirst( $one_page->post_status ) ) . ''; } // Add CSS if we have children $args_childs = $args; $args_childs['parent'] = $one_page->ID; $args_childs['post_parent'] = $one_page->ID; $args_childs['child_of'] = $one_page->ID; // can we run this only if the page actually has children? is there a property in the result of get_children for this? // eh, you moron, we already got that info in $post_children_count! // so result is from 690 queries > 474 = 216 queries less. still many.. $str_child_output = ''; if ( $post_children_count > 0 ) { $str_child_output = admin_menu_tree_page_view_get_content( $args_childs ); $class .= ' admin-menu-tree-page-view-has-childs'; } // if we are editing a post, we should see it in the tree, right? // don't use on bulk edit, then post is an array and not a single post id if ( isset( $_GET['action'] ) && 'edit' === (string) $_GET['action'] && isset( $_GET['post'] ) && is_integer( $_GET['post'] ) ) { // if post with id get[post] is a parent of the current post, show it if ( (int) $_GET['post'] !== $one_page->ID ) { $post_to_check_parents_for = $_GET['post']; // seems to be a problem with get_post_ancestors (yes, it's in the trac too) // Long time since I wrote this, but perhaps this is the problem (adding for future reference): // http://core.trac.wordpress.org/ticket/10381 // @done: this is done several times. only do it once please // before: 441. after: 43 $one_page_parents = amtpv_get_post_ancestors( $post_to_check_parents_for ); } } $class .= ' nestedSortable'; $output .= '
  • '; // First DIV used for nestedSortable $output .= '
    '; // DIV used to make hover work and to put edit-popup outside the $output .= '
    '; // Drag handle $output .= ''; $output .= '' . $status_span; $output .= $title; // Add the view link, hidden, used in popup $permalink = get_permalink( $one_page->ID ); $output .= ''; // Popup edit div $output .= '
    ' . __( 'Edit', 'admin-menu-tree-page-view' ) . '
    |
    ' . __( 'View', 'admin-menu-tree-page-view' ) . '
    ' . __( 'Add new content', 'admin-menu-tree-page-view' ) . '
    ' . __( 'After', 'admin-menu-tree-page-view' ) . '
    |
    ' . __( 'Inside', 'admin-menu-tree-page-view' ) . '
    ' . __( 'Post ID:', 'admin-menu-tree-page-view' ) . ' ' . $one_page->ID . '
    '; // Close DIV used to make hover work and to put edit-popup outside the $output .= '
    '; // Close DIV for nestedSortable $output .= '
    '; // Add child posts $output .= $str_child_output; $output .= '
  • '; } // If this is a child listing, add