Skip to content

Instantly share code, notes, and snippets.

@fjarrett
Last active Dec 27, 2015
Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@johnregan3 johnregan3 commented Nov 7, 2013

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

@johnregan3

This comment has been minimized.

Copy link

@johnregan3 johnregan3 commented Nov 7, 2013

Beautiful, BTW.

@fjarrett

This comment has been minimized.

Copy link
Owner Author

@fjarrett 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

This comment has been minimized.

Copy link
Owner Author

@fjarrett 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