No permission to manage posts.'; return; } $limit = 5; $args = [ 'post_type' => 'post', 'post_status' => 'draft', 'limit' => $limit, 'orderby' => 'date', 'order' => 'DESC', ]; $query = new \WP_Query($args); $posts = $query->get_posts(); if (!$posts) { echo '
No posts in draft status.
'; return; } echo ''; echo ''; $formatDate = get_option('date_format'); foreach ($posts as $post) { $name = strlen($post->post_title) > 28 ? substr($post->post_title, 0, 28) . '...' : $post->post_title; $url = get_edit_post_link($post->ID); $date = wp_date($formatDate, strtotime($post->post_date)); echo '' . '' . '' . ''; } echo '
DateTitle
' . esc_html($date) . '' . esc_html($name) . '
'; if (count($posts) >= $limit) { $url = admin_url('edit.php?post_status=draft&post_type=post'); echo '
' . '
Showing ' . intval($limit) . ' of ' . intval($query->found_posts) . '
' . '
See all
' . '
'; } } }