Custom Icon for Custom Post Type in WordPress
If you have created a custom post type in WordPress then you should customize the icon for your custom post type. As of version 3.8 it’s a easy as adding another parameter to your post type.
- Visit http://melchoyce.github.io/dashicons/
- Pick desired icon and get name of icon
- Add name of dashicon to menu_icon parameter in register_post_type options array
'menu_icon' => 'dashicons-megaphone'
In context it looks like this:
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'experience',
array(
'labels' => array(
'name' => __( 'Experiences' ),
'singular_name' => __( 'Experience' )
),
'taxonomies' => array( 'category' ),
'public' => true,
'has_archive' => true,
'menu_icon' => 'dashicons-megaphone',
'supports' => array(
'title',
'editor',
'author',
'thumbnail',
'custom-fields',
'comments',
'revisions'
)
)
);
}