<?php
/**
* Scripts and stylesheets
*
* Enqueue stylesheets in the following order:
* 1. /theme/assets/css/bootstrap.css
* 2. /theme/assets/css/bootstrap-responsive.css
* 3. /theme/assets/css/app.css
* 4. /child-theme/style.css (if a child theme is activated)
*
* Enqueue scripts in the following order:
* 1. jquery-1.9.1.min.js via Google CDN
* 2. /theme/assets/js/vendor/modernizr-2.6.2.min.js
* 3. /theme/assets/js/plugins.js (in footer)
* 4. /theme/assets/js/main.js (in footer)
*/
function DeinTheme_scripts() {
wp_enqueue_style('DeinTheme_bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css', false, null);
wp_enqueue_style('DeinTheme_bootstrap_responsive', get_template_directory_uri() . '/assets/css/bootstrap-responsive.css', array('DeinTheme_bootstrap'), null);
wp_enqueue_style('DeinTheme', get_template_directory_uri() . '/assets/css/app.css', false, null);
// Load style.css from child theme
if (is_child_theme()) {
wp_enqueue_style('DeinTheme_child', get_stylesheet_uri(), false, null);
}
// jQuery is loaded using the same method from HTML5 Boilerplate:
// Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline
// It's kept in the header instead of footer to avoid conflicts with plugins.
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', false, null, false);
}
if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr-2.6.2.min.js', false, null, false);
wp_register_script('DeinTheme_plugins', get_template_directory_uri() . '/assets/js/plugins.js', false, null, true);
wp_register_script('DeinTheme_main', get_template_directory_uri() . '/assets/js/main.js', false, null, true);
wp_enqueue_script( 'fitvids', get_template_directory_uri() . '/assets/js/vendor/jquery.fitvids.min.js', array( 'jquery' ), '1.1' );
wp_enqueue_script('jquery');
wp_enqueue_script('modernizr');
wp_enqueue_script('DeinTheme_plugins');
wp_enqueue_script('DeinTheme_main');
}
add_action('wp_enqueue_scripts', 'DeinTheme_scripts', 100);