Created
July 1, 2014 03:05
-
-
Save chriswallace/009a99e7bf3fc0a971d4 to your computer and use it in GitHub Desktop.
Child theme for Worldview
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
/** | |
* Returns the Google font stylesheet URL, if available. | |
* | |
* The use of Source Sans Pro and Bitter by default is localized. For languages | |
* that use characters not supported by the font, the font can be disabled. | |
* | |
* @return string Font stylesheet or empty string if disabled. | |
*/ | |
function largo_fonts_url() { | |
$fonts_url = ''; | |
/* Translators: If there are characters in your language that are not | |
* supported by PT Sans, translate this to 'off'. Do not translate | |
* into your own language. | |
*/ | |
$cabin = _x( 'on', 'Cabin font: on or off', 'largo' ); | |
/* Translators: If there are characters in your language that are not | |
* supported by Merriweather, translate this to 'off'. Do not translate into your | |
* own language. | |
*/ | |
$merriweather = _x( 'on', 'Merriweather font: on or off', 'largo' ); | |
if ( 'off' !== $cabin || 'off' !== $merriweather ) { | |
$font_families = array(); | |
if ( 'off' !== $cabin ) | |
$font_families[] = 'Cabin:400,700'; | |
if ( 'off' !== $merriweather ) | |
$font_families[] = 'Merriweather:400,400italic'; | |
$query_args = array( | |
'family' => urlencode( implode( '|', $font_families ) ), | |
'subset' => urlencode( 'latin,latin-ext' ), | |
); | |
$fonts_url = add_query_arg( $query_args, "//fonts.googleapis.com/css" ); | |
} | |
return $fonts_url; | |
} | |
function largo_remove_worldview_fonts(){ | |
wp_dequeue_style('worldview-fonts'); | |
wp_dequeue_style('worldview-style'); | |
} | |
add_action('wp_enqueue_scripts','largo_remove_worldview_fonts',100); | |
function largo_enqueue_fonts(){ | |
wp_enqueue_style('largo-fonts', largo_fonts_url() ); | |
} | |
add_action('wp_enqueue_scripts','largo_enqueue_fonts',101); | |
function largo_enqueue_styles(){ | |
wp_enqueue_style('largo-style', get_stylesheet_uri() ); | |
} | |
add_action('wp_enqueue_scripts','largo_enqueue_styles',102); | |
function largo_enqueue_scripts(){ | |
wp_dequeue_script('worldview-main' ); | |
wp_enqueue_script('largo-scripts', get_stylesheet_directory_uri() . '/assets/js/largo.js', false, array('jquery') ); | |
} | |
add_action('wp_enqueue_scripts','largo_enqueue_scripts',101); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment