Skip to content

Instantly share code, notes, and snippets.

@fjarrett
Last active December 27, 2015 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fjarrett/7358625 to your computer and use it in GitHub Desktop.
Save fjarrett/7358625 to your computer and use it in GitHub Desktop.
Activate font smoothing for MP6
<?php
/**
* Adds font smoothing to MP6 in the Admin Bar and the entire WP Admin area.
*
* @print HTML
* @action admin_head
* @action wp_head
*/
function fjarrett_mp6_font_smoothing() {
if ( ! is_plugin_active( 'mp6/mp6.php' ) )
return;
$selector = is_admin() ? '#wpadminbar, body' : '#wpadminbar';
// webkit-font-smoothing: Chrome, Safari, Opera
// moz-osx-font-smoothing: Firefox 25+ on OSX
printf( '<style type="text/css">%s { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }</style>', esc_html( $selector ) );
}
add_action( 'admin_head', 'fjarrett_mp6_font_smoothing' );
add_action( 'wp_head', 'fjarrett_mp6_font_smoothing' );
@johnregan3
Copy link

@fjarrett Do you have plans to implement this, like an MP6 contrib or a plugin?

@johnregan3
Copy link

Beautiful, BTW.

@fjarrett
Copy link
Author

fjarrett commented Nov 7, 2013

@johnregan3 Maybe when I have the spare time this can be made into a free plugin...or better yet, you could make/release the plugin and just make me a co-author :-)

@fjarrett
Copy link
Author

fjarrett commented Nov 7, 2013

@johnregan3 BTW once we see how MP6 is going to be integrated into WordPress 3.8 (like if it will be default or not) we'll have to wrap everything with a new conditional, like:

global $wp_version;

if ( is_plugin_active( 'mp6/mp6.php' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment