closes #81 - moving get_roots_stylesheets to the hooks

This commit is contained in:
Ben Word
2011-06-30 18:10:32 -06:00
parent 9428eab591
commit c4d4ee40c6
4 changed files with 73 additions and 75 deletions

View File

@@ -12,51 +12,6 @@ locate_template(array('inc/roots-custom.php'), true, true); // custom functions
$roots_options = roots_get_theme_options(); $roots_options = roots_get_theme_options();
// get active theme directory name
// this allows you to rename the theme directory without breaking anything
$theme_name = next(explode('/themes/', get_template_directory()));
function get_roots_stylesheets() {
global $roots_options;
$roots_css_framework = $roots_options['css_framework'];
$template_uri = get_template_directory_uri();
$styles = '';
if ($roots_css_framework === 'blueprint') {
$styles .= "<link rel=\"stylesheet\" href=\"$template_uri/css/blueprint/screen.css\">\n";
} elseif ($roots_css_framework === '960gs_12' || $roots_css_framework === '960gs_16') {
$styles .= "<link rel=\"stylesheet\" href=\"$template_uri/css/960/reset.css\">\n";
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/960/text.css\">\n";
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/960/960.css\">\n";
} elseif ($roots_css_framework === '960gs_24') {
$styles .= "<link rel=\"stylesheet\" href=\"$template_uri/css/960/reset.css\">\n";
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/960/text.css\">\n";
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/960/960_24_col.css\">\n";
} elseif ($roots_css_framework === '1140') {
$styles .= "<link rel=\"stylesheet\" href=\"$template_uri/css/1140/1140.css\">\n";
} elseif ($roots_css_framework === 'adapt') {
$styles .= "<link rel=\"stylesheet\" href=\"$template_uri/css/adapt/master.css\">\n";
$styles .= "\t<noscript>\n";
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/adapt/mobile.css\">\n";
$styles .= "\t</noscript>\n";
}
if (class_exists('RGForms')) {
$styles .= "\t<link rel=\"stylesheet\" href=\"" . plugins_url(). "/gravityforms/css/forms.css\">\n";
}
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/style.css\">\n";
if ($roots_css_framework === 'blueprint') {
$styles .= "\t<!--[if lt IE 8]><link rel=\"stylesheet\" href=\"$template_uri/css/blueprint/ie.css\"><![endif]-->\n";
} elseif ($roots_css_framework === '1140') {
$styles .= "\t<!--[if lt IE 8]><link rel=\"stylesheet\" href=\"$template_uri/css/1140/ie.css\"><![endif]-->\n";
}
return $styles;
}
// set the maximum 'Large' image width to the maximum grid width // set the maximum 'Large' image width to the maximum grid width
if (!isset($content_width)) { if (!isset($content_width)) {
global $roots_options; global $roots_options;

View File

@@ -10,7 +10,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php echo get_roots_stylesheets(); ?> <?php echo roots_stylesheets(); ?>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> Feed" href="<?php echo home_url(); ?>/feed/"> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> Feed" href="<?php echo home_url(); ?>/feed/">

View File

@@ -4,6 +4,7 @@ add_action('roots_head', 'roots_google_analytics');
add_action('roots_head', 'roots_fout_b_gone'); add_action('roots_head', 'roots_fout_b_gone');
add_action('roots_head', 'roots_1140_head'); add_action('roots_head', 'roots_1140_head');
add_action('roots_head', 'roots_adapt_head'); add_action('roots_head', 'roots_adapt_head');
add_action('roots_stylesheets', 'roots_get_stylesheets');
add_action('roots_header_before', 'roots_1140_header_before'); add_action('roots_header_before', 'roots_1140_header_before');
add_action('roots_header_after', 'roots_1140_header_after'); add_action('roots_header_after', 'roots_1140_header_after');
add_action('roots_footer_before', 'roots_1140_footer_before'); add_action('roots_footer_before', 'roots_1140_footer_before');
@@ -68,6 +69,47 @@ function roots_adapt_head() {
} }
} }
function roots_get_stylesheets() {
global $roots_options;
$roots_css_framework = $roots_options['css_framework'];
$template_uri = get_template_directory_uri();
$styles = '';
if ($roots_css_framework === 'blueprint') {
$styles .= "<link rel=\"stylesheet\" href=\"$template_uri/css/blueprint/screen.css\">\n";
} elseif ($roots_css_framework === '960gs_12' || $roots_css_framework === '960gs_16') {
$styles .= "<link rel=\"stylesheet\" href=\"$template_uri/css/960/reset.css\">\n";
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/960/text.css\">\n";
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/960/960.css\">\n";
} elseif ($roots_css_framework === '960gs_24') {
$styles .= "<link rel=\"stylesheet\" href=\"$template_uri/css/960/reset.css\">\n";
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/960/text.css\">\n";
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/960/960_24_col.css\">\n";
} elseif ($roots_css_framework === '1140') {
$styles .= "<link rel=\"stylesheet\" href=\"$template_uri/css/1140/1140.css\">\n";
} elseif ($roots_css_framework === 'adapt') {
$styles .= "<link rel=\"stylesheet\" href=\"$template_uri/css/adapt/master.css\">\n";
$styles .= "\t<noscript>\n";
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/adapt/mobile.css\">\n";
$styles .= "\t</noscript>\n";
}
if (class_exists('RGForms')) {
$styles .= "\t<link rel=\"stylesheet\" href=\"" . plugins_url(). "/gravityforms/css/forms.css\">\n";
}
$styles .= "\t<link rel=\"stylesheet\" href=\"$template_uri/css/style.css\">\n";
if ($roots_css_framework === 'blueprint') {
$styles .= "\t<!--[if lt IE 8]><link rel=\"stylesheet\" href=\"$template_uri/css/blueprint/ie.css\"><![endif]-->\n";
} elseif ($roots_css_framework === '1140') {
$styles .= "\t<!--[if lt IE 8]><link rel=\"stylesheet\" href=\"$template_uri/css/1140/ie.css\"><![endif]-->\n";
}
echo $styles;
}
function roots_1140_header_before() { function roots_1140_header_before() {
global $roots_options; global $roots_options;
$roots_css_framework = $roots_options['css_framework']; $roots_css_framework = $roots_options['css_framework'];

View File

@@ -2,6 +2,7 @@
// header.php // header.php
function roots_head() { do_action('roots_head'); } 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_wrap_before() { do_action('roots_wrap_before'); }
function roots_header_before() { do_action('roots_header_before'); } function roots_header_before() { do_action('roots_header_before'); }
function roots_header_inside() { do_action('roots_header_inside'); } function roots_header_inside() { do_action('roots_header_inside'); }