Last active
August 29, 2015 14:06
-
-
Save macbookandrew/127a1169f934bfd9e7a9 to your computer and use it in GitHub Desktop.
WordPress—deregister built-in webfonts
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
// deregister Bitter and Open Sans webfonts only | |
function deregister_default_fonts() { | |
wp_deregister_style( 'twentythirteen-fonts' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'deregister_default_fonts', 100 ); | |
// remove default fonts, add custom fonts, and use a custom minified stylesheet and register but don’t enqueue style.css with all the theme information | |
function add_custom_css() { | |
wp_enqueue_style( 'theme-style', get_stylesheet_directory_uri() . '/style.min.css' ); | |
wp_dequeue_style( 'twentythirteen-style' ); | |
// fonts | |
wp_dequeue_style( 'twentythirteen-fonts' ); | |
wp_deregister_style( 'open-sans' ); | |
wp_register_style( 'open-sans', false ); // dependency workaround from https://gist.github.com/thetrickster/8946567 | |
wp_dequeue_style( 'bitter' ); | |
wp_enqueue_style( 'webfonts', '//fonts.googleapis.com/css?family=Alegreya+Sans:400,700,400italic|Alegreya:400,700' ); | |
} | |
add_action( 'wp_print_styles', 'add_custom_css' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment