Fix #347 - Properly enqueue stylesheets
This commit is contained in:
@@ -10,8 +10,6 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
<?php roots_stylesheets(); ?>
|
||||
|
||||
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> Feed" href="<?php echo home_url(); ?>/feed/">
|
||||
|
||||
<script src="<?php echo get_template_directory_uri(); ?>/js/libs/modernizr-2.5.3.min.js"></script>
|
||||
|
||||
@@ -1,30 +1,5 @@
|
||||
<?php
|
||||
|
||||
function roots_get_stylesheets() {
|
||||
$styles = '';
|
||||
$styles .= stylesheet_link_tag('/style.css', 1);
|
||||
$styles .= stylesheet_link_tag('/bootstrap.css', 1);
|
||||
|
||||
if (BOOTSTRAP_RESPONSIVE) {
|
||||
$styles .= stylesheet_link_tag('/bootstrap-responsive.css', 1);
|
||||
}
|
||||
|
||||
$styles .= stylesheet_link_tag('/app.css', 1);
|
||||
|
||||
if (is_child_theme()) {
|
||||
$styles .= "\t<link rel=\"stylesheet\" href=\"" . get_stylesheet_uri(). "\">\n";
|
||||
}
|
||||
|
||||
echo $styles;
|
||||
}
|
||||
|
||||
function stylesheet_link_tag($file, $tabs = 0, $newline = true, $rel = 'stylesheet') {
|
||||
$indent = str_repeat("\t", $tabs);
|
||||
return $indent . '<link rel="' . $rel .'" href="' . get_template_directory_uri() . '/css' . $file . '">' . ($newline ? "\n" : "");
|
||||
}
|
||||
|
||||
add_action('roots_stylesheets', 'roots_get_stylesheets');
|
||||
|
||||
function roots_google_analytics() {
|
||||
$roots_google_analytics_id = GOOGLE_ANALYTICS_ID;
|
||||
if ($roots_google_analytics_id !== '') {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
// header.php
|
||||
function roots_head() { do_action('roots_head'); }
|
||||
function roots_stylesheets() { do_action('roots_stylesheets'); }
|
||||
function roots_wrap_before() { do_action('roots_wrap_before'); }
|
||||
function roots_header_before() { do_action('roots_header_before'); }
|
||||
function roots_header_inside() { do_action('roots_header_inside'); }
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
<?php
|
||||
|
||||
function roots_scripts() {
|
||||
wp_enqueue_style('roots_style', get_template_directory_uri() . '/css/style.css', false, null);
|
||||
wp_enqueue_style('roots_bootstrap_style', get_template_directory_uri() . '/css/bootstrap.css', array('roots_style'), null);
|
||||
|
||||
if (BOOTSTRAP_RESPONSIVE) {
|
||||
wp_enqueue_style('roots_bootstrap_responsive_style', get_template_directory_uri() . '/css/bootstrap-responsive.css', array('roots_bootstrap_style'), null);
|
||||
}
|
||||
|
||||
wp_enqueue_style('roots_app_style', get_template_directory_uri() . '/css/app.css', false, null);
|
||||
|
||||
if (is_child_theme()) {
|
||||
wp_enqueue_style('roots_child_style', get_stylesheet_uri(), array('roots_style'), null);
|
||||
}
|
||||
|
||||
if (!is_admin()) {
|
||||
wp_deregister_script('jquery');
|
||||
wp_register_script('jquery', '', '', '', false);
|
||||
@@ -10,14 +23,8 @@ function roots_scripts() {
|
||||
wp_enqueue_script('comment-reply');
|
||||
}
|
||||
|
||||
if (is_multisite() || is_child_theme()) {
|
||||
$base = get_template_directory_uri();
|
||||
} else {
|
||||
$base = '';
|
||||
}
|
||||
|
||||
wp_register_script('roots_plugins', $base . '/js/plugins.js', false, null, false);
|
||||
wp_register_script('roots_script', $base . '/js/script.js', false, null, false);
|
||||
wp_register_script('roots_plugins', get_template_directory_uri() . '/js/plugins.js', false, null, false);
|
||||
wp_register_script('roots_script', get_template_directory_uri() . '/js/script.js', false, null, false);
|
||||
wp_enqueue_script('roots_plugins');
|
||||
wp_enqueue_script('roots_script');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user