Adding font icons to WordPress custom post types

01 July, 2014 by Tom Elliott

Prior to WordPress 3.8, if we wanted custom icons to appear in the WordPress admin menu for custom post types, we would have to source or create our icons manually.

Enter Dashicons. These icons were introduced in WordPress 3.8 and are the official icon fonts used for the WordPress admin. We can now easily make use of around 200 vector based icons in the admin menu for our custom post types.

WordPress Dashicons icon fonts

WordPress 3.8 icon fonts (dashicons) enable easy custom post type icon selection

All you need to do to add an icon font to your custom post type is:

  1. Head over to http://melchoyce.github.io/dashicons/ and select an icon you like
  2. Make a note of the icon font name. e.g. ‘dashicons-smiley’
  3. Use this name as the ‘menu_icon’ array parameter in your custom post type arguments. i.e:
'menu_icon' => 'dashicons-smiley',

That’s all there is to it! The icon font for your custom post type should now appear in the admin menu



5 simple ways to customise the WordPress login page »


Leave a Reply

Your email address will not be published. Required fields are marked *

css.php