Tutorials WordPress

How to Use Dashicons for Custom Post Types

Updated

Written by

Dave Warfel

Reading Time

2 minutes

If you buy something from one of our links, we may earn a commission.

WordPress 3.8 “Parker” has officially been out since December 12th, and here at WP Smackdown, we unanimously love the new admin design. We loved the design so much, we couldn’t wait for the release and happily installed the MP6 plugin long ago.

One of the key design elements that we like is the use of the Dashicons next to each post type. Instead of having to dig around in our plethora of icons to find the perfect 16×16 icon for our custom post types, we can now use Dashicons. We’re big fans of using clean, flexible icons with easy implementation instructions. Also check out Font Awesome, which was designed for Bootstrap, if you haven’t seen them before.

Add a Dashicon class to menu_icon

Dashicons are easy to implement because they come pre-installed with WordPress core. When you are registering a custom post type, find the parameter 'menu_icon' => ''. In the single quotes on the right, just add the CSS class of the Dashicon you’d like to use. If you have a custom post type called “Projects,” and would like to use a star as the icon, you’d simply write the code like this:
'menu_icon' => 'dashicons-star-filled'

Large Library of Dashicons

Here’s a link to all of the current Dashicons. To find the CSS class of the Dashicon you’d like to use, just click on the icon, and then click the “Copy HTML” link. It’s the secondary CSS class listed after “dashicons.”

Dashicons Copy HTML Link
Click on the “Copy HTML” link, and grab the 2nd class after “dashicons.”

Dave Warfel

LinkedIn  •  X (Twitter)Dave has been working with WordPress since 2011. He's built 100s of client sites and almost a dozen of his own. He's tested almost every plugin you can think of, hosted with at least 10 different companies, and gone down every SEO rabbit hole you can imagine. When's he's not tinkering with new software, you'll find him in the mountains of Colorado, trail running, summiting peaks, and rippin' downhills on his mountain bike. 🏔️🏃🚴🤸

One response to “How to Use Dashicons for Custom Post Types”

  1. Rob Avatar
    Rob

    The current Dashicons. link is not working

Leave a Comment