'; if($is_child == 'child') { $output .= '— '; } /* Display post status */ switch(get_post_status($post_id)) { case 'draft': case 'pending': case 'future' : $output .= ''; break; } if($current_post_ID == ($post_id)) $output .= ''; /* Display post title */ $output .= $title; if($current_post_ID == ($post_id)) $output .= ''; switch(get_post_status($post_id)) { case 'draft': case 'pending': case 'future' : $output .= ''; break; } $output .= ''; /*** Search for children ***/ $children = get_posts(array( 'post_parent' => $post_id, 'post_type' => $post_type, "orderby" => "menu_order", 'post_status' => 'any', )); if($children) { foreach($children as $child) { $output .= build_post_list_item($child->ID,$post_type,'child'); } } $output .= ''; return $output; } add_action('admin_menu', 'custom_post_list_view', 11); function custom_post_list_view() { /** Get settings **/ $settings = get_option( 'ampl_settings' ); /*** Get all post types ***/ $post_types = get_post_types(); foreach ($post_types as $post_type) { /*** If enabled in settings ***/ if($settings['post_types'][$post_type] == 'on' ) { $max_limit = $settings['max_limit'][$post_type]; $custom_menu_slug = $post_type; $output = ''; $args = array( "post_type" => $post_type, "parent" => "0", "post_parent" => "0", "numberposts" => "-1", "orderby" => "menu_order", "order" => "ASC", "post_status" => "any", "suppress_filters" => 0 ); $posts = get_posts($args); if($posts) { $output .= ''; $output .= '
' . '
' . '
' . '
'; $count=0; foreach ($posts as $post) { if(($max_limit==0) || ($count<$max_limit)) $output .= build_post_list_item($post->ID,$post_type,'parent'); $count++; } $output .= '
'; $output .= ''; if($post_type == 'post') { add_posts_page( "Title", $output, "edit_posts", $custom_menu_slug, "custom_post_list_view_page"); } else { if ($post_type == 'page') { add_pages_page( "Title", $output, "edit_pages", $custom_menu_slug, "custom_post_list_view_page"); } else { if($post_type == 'attachment') { add_media_page("Title", $output, "edit_posts", $custom_menu_slug, "custom_post_list_view_page"); } else { add_submenu_page(('edit.php?post_type=' . $post_type), "Title", $output, "edit_posts", '', "custom_post_list_view_page"); } } } } } } // End foreach post type } function custom_post_list_view_page() { /* Empty */ } /* * Add admin menu style in header */ function custom_post_list_view_css() { ?> Select post types to enable', 'ampl_settings_field_input', 'ampl_settings_section_page_name', 'ampl_settings_section'); } function ampl_settings_section_page() { /* echo '

Main description

'; */ } function ampl_settings_field_input() { // $options = get_option('ampl_settings'); // echo ""; $settings = get_option( 'ampl_settings'); ?> Post type Number of items (0=unlimited) true)); $exclude_types = array('attachment'); foreach ($all_post_types as $key) { if(!in_array($key, $exclude_types)) { $post_types = isset( $settings['post_types'][ $key ] ) ? esc_attr( $settings['post_types'][ $key ] ) : ''; if(isset( $settings['max_limit'][ $key ] ) ) { $max_number = $settings['max_limit'][ $key ]; } else { $max_number = '0'; } /* /> */ ?> /> true ); $post_types = get_post_types( $args ); unset( $post_types[ 'attachment' ] ); return apply_filters( 'ampl_get_post_types', $post_types ); } function ampl_settings_page() { ?>

Admin Menu Post List