How to show the number of custom post type items in “At a Glance”
I recently moved all my plugin announcement posts to a custom post type called Announcements. This allows me to keep my blog posts focussed on some awesome WordPress tutorials that I am writing. So, do subscribe to my newsletter to receive them directly in your inbox!
By default, the number of posts from a custom post type doesn’t show up in the At a Glance widget in the WordPress dashboard. I also find that an easy way to navigate to custom post types.
Here’s a custom snippet I use in my mu-plugins folder to display the number of announcements.
You can also pass an array of post types to $post_types in Line 10 above. I use that for a custom plugin I’ve built using ACF that has multiple custom post types.
The result is an updated At a Glance widget which now shows the number of announcements.

Customise the Icon
By default, a circular icon is displayed, as you can see in the screenshot above. But, if you’d like, you can replace this with any other icon. I like using Dashicons and had picked the megaphoneOpens in a new window when registering my custom post type.
This code will allow you to add CSS to the admin_head. Change \f488 to the code of the dashicon of your choosing.
Like this tutorial? Let me know what you think!

