Created
February 10, 2015 04:44
-
-
Save designbuildtest/584efcc0405c5ef4d37a to your computer and use it in GitHub Desktop.
Disable Google Open Sans font in the Admin area
This file contains hidden or 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
/** | |
* Disable Google Open Sans font in the Admin area . Implementation idea from ... https://wordpress.org/plugins/disable-google-fonts/ | |
*/ | |
function myplugin_admin_area_minus_open_sans_style() { | |
// Remove Open Sans. Doesn't work :-( | |
// See 'Disable_Google_Fonts' class below as an alternative. | |
wp_dequeue_style('open-sans-css'); | |
// Add custom style definitions to compensate for the removal of Open Sans | |
wp_enqueue_style('myplugin-admin-minus-open-sans', plugins_url( 'css/admin-minus-open-sans.css', __FILE__ ), false, '1.0.0', 'all'); | |
} | |
add_action('admin_enqueue_scripts', 'myplugin_admin_area_minus_open_sans_style', 9999); | |
class Disable_Google_Fonts { | |
public function __construct() { | |
add_filter( 'gettext_with_context', array( $this, 'disable_open_sans' ), 888, 4 ); | |
} | |
public function disable_open_sans($translations, $text, $context, $domain) { | |
if ( 'Open Sans font: on or off' == $context && 'on' == $text ) { | |
$translations = 'off'; | |
} | |
return $translations; | |
} | |
} | |
if ( is_admin() ) { | |
$disable_google_fonts = new Disable_Google_Fonts; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment