Skip to content

Instantly share code, notes, and snippets.

@digiltd
Last active August 29, 2015 14:02
Show Gist options
  • Save digiltd/6af59e9c6ec87e107151 to your computer and use it in GitHub Desktop.
Save digiltd/6af59e9c6ec87e107151 to your computer and use it in GitHub Desktop.
fn wp add Fontawesome to WP-Admin
<?php
// SOURCE: http://coolestguidesontheplanet.com/hooking-fontawesome-use-wordpress-dashboard-admin-menus/
function fontawesome_dashboard() {
wp_enqueue_style('fontawesome', 'http:////netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css', '', '4.0.3', 'all');
}
add_action('admin_init', 'fontawesome_dashboard');
/* The function is made of echoing the CSS style, with the font-family set to FontAwesome with the
!important override set and the new unicode number with the extra \ to escape the other one.
The action then adds to to the ‘admin_head‘ which will just appear in just the head section of the
backend admin pages. */
function fontawesome_icon_dashboard() {
echo "<style type='text/css' media='screen'>
icon16.icon-media:before, #adminmenu .menu-icon-media div.wp-menu-image:before {
font-family: Fontawesome !important;
content: '\\f03e';
}
</style>";
}
add_action('admin_head', 'fontawesome_icon_dashboard');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment