-
-
Save timkinnane/30809524e8525a5d92b8 to your computer and use it in GitHub Desktop.
Replace WP dashboard and admin bar font with your own (optional) locally hosted font. NOTE: I've used Roboto to match my theme, but called it Open Sans. This prevents error for admin plugin dependencies that expect an Open Sans style to be registered. WHY: If I'm doing local development offline page loads were always delayed by the Google Fonts …
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
<?php | |
// Reregister Open-sans as Roboto. | |
function replace_open_sans() { | |
// Replace the URL with your local or remote css | |
$roboto_open_sans_url = get_template_directory_uri().'/assets/fonts/roboto-hack.css'; | |
wp_deregister_style( 'open-sans' ); | |
wp_register_style( 'open-sans', $roboto_open_sans_url ); | |
} | |
add_action( 'admin_enqueue_scripts', 'replace_open_sans' ); | |
add_action( 'wp_enqueue_scripts', 'replace_open_sans' ); |
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
/* Using http://www.fontsquirrel.com/tools/webfont-generato */ | |
@font-face { | |
font-family: 'Open Sans'; | |
src: url('roboto-light-webfont.eot'); | |
src: url('roboto-light-webfont.eot?#iefix') format('embedded-opentype'), | |
url('roboto-light-webfont.woff2') format('woff2'), | |
url('roboto-light-webfont.woff') format('woff'), | |
url('roboto-light-webfont.ttf') format('truetype'), | |
url('roboto-light-webfont.svg#robotolight') format('svg'); | |
font-weight: normal; | |
font-style: normal; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment