Last active
December 11, 2015 10:18
-
-
Save vc27/4585843 to your computer and use it in GitHub Desktop.
Adding Fonts to WordPress
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
/** | |
* @package WordPress | |
* @license GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | |
* @version 1.0 | |
* @updated 01.21.13 | |
* | |
* Description: | |
* Adding fonts to wordpress is best done in a two step process. 1. Register your fonts with the | |
* wp-system via wp_register_style. 2. Enqueue your fonts with wp_enqueue_style. | |
* | |
* Codex: | |
* wp_register_style - http://codex.wordpress.org/Function_Reference/wp_register_style | |
* wp_enqueue_style - http://codex.wordpress.org/Function_Reference/wp_enqueue_style | |
* | |
* Font Usage: | |
* See W3 Schools CSS Fonts for accepted css usage. | |
* http://www.w3schools.com/css/css_font.asp | |
**/ | |
#################################################################################################### */ | |
/** | |
* Register Styles and Scripts | |
* | |
* @version 1.0 | |
* @updated 01.21.13 | |
**/ | |
add_action( 'init', 'theme__register_styles' ); | |
function theme__register_styles() { | |
// Default CSS | |
wp_register_style( 'google-fonts', "http://fonts.googleapis.com/css?family=Fruktur" ); | |
} // end function register_style_and_scripts | |
/** | |
* Add CSS | |
* | |
* @version 1.0 | |
* @updated 01.21.13 | |
**/ | |
add_action( 'wp_print_styles', 'theme__wp_print_styles' ); | |
function theme__wp_print_styles() { | |
wp_enqueue_style( 'google-fonts' ); | |
} // end function wp_print_styles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment