Last active
December 27, 2015 16:59
-
-
Save fjarrett/7358625 to your computer and use it in GitHub Desktop.
Activate font smoothing for MP6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); |
Beautiful, BTW.
@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 :-)
@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
@fjarrett Do you have plans to implement this, like an MP6 contrib or a plugin?