Load Child Themes Canvas Parent CSS without @import
Tested on Canvas 5.9.x
[php]
function canvas_enqueue_parent_style() {
// Load Child Themes Canvas Parent CSS without @import via Frog Stone Media
wp_enqueue_style( ‘canvas’, get_template_directory_uri() . ‘/style.css’ );
}
add_action( ‘wp_enqueue_scripts’, ‘canvas_enqueue_parent_style’ );
[/php]
Set jQuery and dependencies to load asynchronously
Tested on Canvas 5.9.x
[php]
if(!is_admin()) {
// Set jQuery and dependencies to load asynchronously via Frog Stone Media
function htwp_async_js ( $url ) {
if ( strpos( $url, ‘.js’ ) === FALSE ){ return $url;}
if ( strpos( $url, ‘jquery.js’ ) > -1 ){ return "$url’ async onload=’myinit()"; }
return "$url’ async onload=’myinit()";
}
add_filter( ‘esc_url’, ‘htwp_async_js’, 11, 1 );
}
else {
}
[/php]
Enqueue Font Awesome
Tested on Canvas 5.9.x
[php]
function import_font_awesome() {
// Enqueue Font Awesome via Frog Stone Media
wp_register_style(‘fontawesome’,’//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css’);
wp_enqueue_style( ‘fontawesome’ );
}
add_action(‘wp_print_styles’, ‘import_font_awesome’);
[/php]
Enqueue Google Fonts
Tested on Canvas 5.9.x
[php]
function import_google_fonts() {
// Google Fonts via Frog Stone Media
wp_register_style(‘googleFontsArimo’,’//fonts.googleapis.com/css?family=Arimo:400,700,400italic,700italic’);
wp_enqueue_style( ‘googleFontsArimo’ );
}
add_action(‘wp_print_styles’, ‘import_google_fonts’);
[/php]
Add custom classes to the body tag and remove unwanted classes – optional IF statement for conditional tags
Tested on Canvas 5.9.x
[php]
add_filter( ‘body_class’, ‘woo_custom_home_full_width’, 999, 2 );
function woo_custom_home_full_width ( $wp_classes, $class ) {
// Change if statement based on Conditional Tags http://codex.wordpress.org/Conditional_Tags via Frog Stone Media
if ( is_home() ) {
// List of classes to remove from body
$blacklist = array(‘two-col-right’, ‘two-col-right-1080’);
// Blacklist result
$wp_classes = array_diff( $wp_classes, $blacklist );
// Body classes to add
$wp_classes = array_merge( $wp_classes, array(‘one-col’,’one-col-1080′) );
}
return $wp_classes;;
}
[/php]