I’m now adding a custom post type in wordpress.
function custom_post_type() {
$labels = array(
'name' => 'Custom Type',
'singular_name' => 'Custom Type',
'menu_name' => 'Custom Type',
// ....
);
$args = array(
// ...
// The below matters!
'menu_icon' => get_template_directory_uri().'/images/my-icon.png',
);
register_post_type( 'custom_type', $args );
}
add_action( 'init', 'custom_post_type', 0 );
My trouble is:
I want to set the menu_icon
as a font-icon, like font-awesome or genericons.
How can I do with it?
Although this is not a fully solution for my question, but it solved my problem:
WordPress after 3.8 use a subset of dashicons as its menu icons.
If we want to use the icon sets of dashicons, just wrote the icon name.
e.g.
See:
https://developer.wordpress.org/resource/dashicons/#format-image
And I wrote a post for an example:
http://www.huangwenchao.com.cn/2015/03/wordpress-dashicon.html