From c4d4ee40c6794f04b988ae09dbfdb683dd02a3ff Mon Sep 17 00:00:00 2001 From: Ben Word Date: Thu, 30 Jun 2011 18:10:32 -0600 Subject: [PATCH] closes #81 - moving get_roots_stylesheets to the hooks --- functions.php | 57 +++++-------------------------------------- header.php | 2 +- inc/roots-actions.php | 42 +++++++++++++++++++++++++++++++ inc/roots-hooks.php | 47 ++++++++++++++++++----------------- 4 files changed, 73 insertions(+), 75 deletions(-) diff --git a/functions.php b/functions.php index 999dcd4..8f4e054 100644 --- a/functions.php +++ b/functions.php @@ -12,62 +12,17 @@ locate_template(array('inc/roots-custom.php'), true, true); // custom functions $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 .= "\n"; - } elseif ($roots_css_framework === '960gs_12' || $roots_css_framework === '960gs_16') { - $styles .= "\n"; - $styles .= "\t\n"; - $styles .= "\t\n"; - } elseif ($roots_css_framework === '960gs_24') { - $styles .= "\n"; - $styles .= "\t\n"; - $styles .= "\t\n"; - } elseif ($roots_css_framework === '1140') { - $styles .= "\n"; - } elseif ($roots_css_framework === 'adapt') { - $styles .= "\n"; - $styles .= "\t\n"; - } - - if (class_exists('RGForms')) { - $styles .= "\t\n"; - } - - $styles .= "\t\n"; - - if ($roots_css_framework === 'blueprint') { - $styles .= "\t\n"; - } elseif ($roots_css_framework === '1140') { - $styles .= "\t\n"; - } - - return $styles; -} - // set the maximum 'Large' image width to the maximum grid width if (!isset($content_width)) { global $roots_options; $roots_css_framework = $roots_options['css_framework']; switch ($roots_css_framework) { - case 'blueprint': $content_width = 950; break; - case '960gs_12': $content_width = 940; break; - case '960gs_16': $content_width = 940; break; - case '960gs_24': $content_width = 940; break; - case '1140': $content_width = 1140; break; - default: $content_width = 950; break; + case 'blueprint': $content_width = 950; break; + case '960gs_12': $content_width = 940; break; + case '960gs_16': $content_width = 940; break; + case '960gs_24': $content_width = 940; break; + case '1140': $content_width = 1140; break; + default: $content_width = 950; break; } } diff --git a/header.php b/header.php index 6803264..34cb9e6 100644 --- a/header.php +++ b/header.php @@ -10,7 +10,7 @@ - + diff --git a/inc/roots-actions.php b/inc/roots-actions.php index e3ed094..6353a4a 100644 --- a/inc/roots-actions.php +++ b/inc/roots-actions.php @@ -4,6 +4,7 @@ add_action('roots_head', 'roots_google_analytics'); add_action('roots_head', 'roots_fout_b_gone'); add_action('roots_head', 'roots_1140_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_after', 'roots_1140_header_after'); 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 .= "\n"; + } elseif ($roots_css_framework === '960gs_12' || $roots_css_framework === '960gs_16') { + $styles .= "\n"; + $styles .= "\t\n"; + $styles .= "\t\n"; + } elseif ($roots_css_framework === '960gs_24') { + $styles .= "\n"; + $styles .= "\t\n"; + $styles .= "\t\n"; + } elseif ($roots_css_framework === '1140') { + $styles .= "\n"; + } elseif ($roots_css_framework === 'adapt') { + $styles .= "\n"; + $styles .= "\t\n"; + } + + if (class_exists('RGForms')) { + $styles .= "\t\n"; + } + + $styles .= "\t\n"; + + if ($roots_css_framework === 'blueprint') { + $styles .= "\t\n"; + } elseif ($roots_css_framework === '1140') { + $styles .= "\t\n"; + } + + echo $styles; +} + function roots_1140_header_before() { global $roots_options; $roots_css_framework = $roots_options['css_framework']; diff --git a/inc/roots-hooks.php b/inc/roots-hooks.php index 90e9d9b..e7041bd 100644 --- a/inc/roots-hooks.php +++ b/inc/roots-hooks.php @@ -1,33 +1,34 @@ \ No newline at end of file