WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 5 months ago

#15406 new enhancement

Add a pending post count indicator to the admin menu

Reported by: iign Owned by:
Priority: normal Milestone: Awaiting Review
Component: Administration Version: 3.0.1
Severity: trivial Keywords: 2nd-opinion ui-focus
Cc:

Description

Comments has an indicator bubble on the dashboard with the pending comments count.

Pending posts should have such a feature, since they are quite more important.

Change History (4)

comment:1 nacin3 years ago

  • Keywords 2nd-opinion added; pending posts removed
  • Milestone changed from Awaiting Review to Future Release

comment:2 somatic3 years ago

  • Summary changed from Pending posts indicator not showing in menu bar to /

Not sure how to integrate this code into the core menu functions, but here's a workaround I'm currently using, which should demonstrate what's missing in the current menu output:

add_filter( 'add_menu_classes', 'show_pending_number');
function show_pending_number( $menu ) {
    $type = "animals";
    $status = "pending";
    $num_posts = wp_count_posts( $type, 'readable' );
    $pending_count = 0;
    if ( !empty($num_posts->$status) )
        $pending_count = $num_posts->$status;

    // build string to match in $menu array
    if ($type == 'post') {
        $menu_str = 'edit.php';
    // support custom post types
    } else {
        $menu_str = 'edit.php?post_type=' . $type;
    }

    // loop through $menu items, find match, add indicator
    foreach( $menu as $menu_key => $menu_data ) {
        if( $menu_str != $menu_data[2] )
            continue;
        $menu[$menu_key][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n($pending_count) . '</span></span>';
    }
    return $menu;
}

comment:3 somatic3 years ago

  • Summary changed from / to Pending posts indicator not showing in menu

comment:4 helen5 months ago

  • Component changed from UI to Administration
  • Keywords ui-focus added
  • Milestone changed from Future Release to Awaiting Review
  • Summary changed from Pending posts indicator not showing in menu to Add a pending post count indicator to the admin menu

Not totally sure what constitutes a pending post, especially once various post statuses are thrown into the mix.

Note: See TracTickets for help on using tickets.