Adding Custom Post Type Counts to the Dashboard

Yes, there are several actions within that widget, including right_now_content_table_end. Example:

function my_right_now() {
    $num_widgets = wp_count_posts( 'widget' );

    $num = number_format_i18n( $num_widgets->publish );
    $text = _n( 'Widget', 'Widgets', $num_widgets->publish );
    if ( current_user_can( 'edit_pages' ) ) { 
        $num = "<a href="https://wordpress.stackexchange.com/questions/5318/edit.php?post_type=widget">$num</a>";
        $text = "<a href="https://wordpress.stackexchange.com/questions/5318/edit.php?post_type=widget">$text</a>";
    }   

    echo '<tr>';
    echo '<td class="first b b_pages">' . $num . '</td>';
    echo '<td class="t pages">' . $text . '</td>';
    echo '</tr>';
}
add_action( 'right_now_content_table_end', 'my_right_now' );

Leave a Comment