Created
April 13, 2018 13:25
-
-
Save UeldoTheme/87d194069f859c19f7ef34e157019eb0 to your computer and use it in GitHub Desktop.
Example child theme which allows you to add custom font from Google Fonts to your WordPress theme.
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 | |
/** | |
* | |
* child theme functions and definitions | |
* | |
*/ | |
add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_scripts' ); | |
function child_theme_enqueue_scripts() { | |
# enqueue google font with this code line | |
wp_enqueue_style( 'child-theme-fonts', add_query_arg( 'family', 'Roboto', '//fonts.googleapis.com/css' ), array(), null ); | |
# enqueue parent theme style | |
wp_enqueue_style( 'child-theme-parent-style', get_template_directory_uri() .'/style.css' ); | |
# enqueue child theme style | |
wp_enqueue_style( 'child-theme-style', get_stylesheet_directory_uri() .'/style.css', array( 'child-theme-parent-style' ) ); | |
} | |
/** | |
* | |
* end of file. | |
* | |
*/ | |
?> |
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
/* | |
Theme Name: Child theme | |
Template: YOUR_ORIGINAL_THEME_NAME_HERE | |
*/ | |
h1 { | |
font-family: 'Roboto'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment