I’m trying to create a submenu page for reordering posts/pages.
Right now I’m trying to include the list that display the different post statuses, for example:
All (5) | Published (4) | Draft (1)
I was digging around in edit.php and found that it pulls the list like this:
$wp_list_table->views();
Which lead me to class-wp-list-table.php where I found this:
function views() {
$screen = get_current_screen();
$views = $this->get_views();
$views = apply_filters( 'views_' . $screen->id, $views );
if ( empty( $views ) )
return;
echo "<ul class='subsubsub'>n";
foreach ( $views as $class => $view ) {
$views[ $class ] = "t<li class='$class'>$view";
}
echo implode( " |</li>n", $views ) . "</li>n";
echo "</ul>";
}
So, since it checks the current screen, would it be possible in someway to set my custom submenu item to “pose” as edit.php although it’s not?
Or if there’s some easier way to do this.
Thanks alot in advance
The class used in
edit.php
is an extension of the WP_List_Table:WP_Posts_List_Table
. Seewp-admin/includes/class-wp-posts-list-table.php
.And here you find a call to
wp_count_posts( $type = 'post', $perm = '' )
. The first parameter is for the post type, the second can be empty orreadable
. If it isreadable
and the current user has no permission to see private posts these posts will be excluded. Thatâs whatWP_Posts_List_Table
does inget_views()
.If you call this function without any arguments on the front page you get something like this: