closes #81 - moving get_roots_stylesheets to the hooks
This commit is contained in:
@@ -12,62 +12,17 @@ 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;
|
||||||
$roots_css_framework = $roots_options['css_framework'];
|
$roots_css_framework = $roots_options['css_framework'];
|
||||||
switch ($roots_css_framework) {
|
switch ($roots_css_framework) {
|
||||||
case 'blueprint': $content_width = 950; break;
|
case 'blueprint': $content_width = 950; break;
|
||||||
case '960gs_12': $content_width = 940; break;
|
case '960gs_12': $content_width = 940; break;
|
||||||
case '960gs_16': $content_width = 940; break;
|
case '960gs_16': $content_width = 940; break;
|
||||||
case '960gs_24': $content_width = 940; break;
|
case '960gs_24': $content_width = 940; break;
|
||||||
case '1140': $content_width = 1140; break;
|
case '1140': $content_width = 1140; break;
|
||||||
default: $content_width = 950; break;
|
default: $content_width = 950; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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/">
|
||||||
|
|
||||||
|
|||||||
@@ -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'];
|
||||||
|
|||||||
@@ -1,33 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// header.php
|
// header.php
|
||||||
function roots_head() { do_action( 'roots_head' ); }
|
function roots_head() { do_action('roots_head'); }
|
||||||
function roots_wrap_before() { do_action( 'roots_wrap_before' ); }
|
function roots_stylesheets() { do_action('roots_stylesheets'); }
|
||||||
function roots_header_before() { do_action( 'roots_header_before' ); }
|
function roots_wrap_before() { do_action('roots_wrap_before'); }
|
||||||
function roots_header_inside() { do_action( 'roots_header_inside' ); }
|
function roots_header_before() { do_action('roots_header_before'); }
|
||||||
function roots_header_after() { do_action( 'roots_header_after' ); }
|
function roots_header_inside() { do_action('roots_header_inside'); }
|
||||||
|
function roots_header_after() { do_action('roots_header_after'); }
|
||||||
|
|
||||||
// 404.php, archive.php, front-page.php, index.php, loop-page.php, loop-search.php, loop-single.php, loop.php
|
// 404.php, archive.php, front-page.php, index.php, loop-page.php, loop-search.php, loop-single.php, loop.php
|
||||||
// page-custom.php, page-full.php, page-sitemap.php, page-subpages.php, page.php, search.php, single.php
|
// page-custom.php, page-full.php, page-sitemap.php, page-subpages.php, page.php, search.php, single.php
|
||||||
function roots_content_before() { do_action( 'roots_content_before' ); }
|
function roots_content_before() { do_action('roots_content_before'); }
|
||||||
function roots_content_after() { do_action( 'roots_content_after' ); }
|
function roots_content_after() { do_action('roots_content_after'); }
|
||||||
function roots_main_before() { do_action( 'roots_main_before' ); }
|
function roots_main_before() { do_action('roots_main_before'); }
|
||||||
function roots_main_after() { do_action( 'roots_main_after' ); }
|
function roots_main_after() { do_action('roots_main_after'); }
|
||||||
function roots_post_before() { do_action( 'roots_post_before' ); }
|
function roots_post_before() { do_action('roots_post_before'); }
|
||||||
function roots_post_after() { do_action( 'roots_post_after' ); }
|
function roots_post_after() { do_action('roots_post_after'); }
|
||||||
function roots_post_inside_before() { do_action( 'roots_post_inside_before' ); }
|
function roots_post_inside_before() { do_action('roots_post_inside_before'); }
|
||||||
function roots_post_inside_after() { do_action( 'roots_post_inside_after' ); }
|
function roots_post_inside_after() { do_action('roots_post_inside_after'); }
|
||||||
function roots_loop_before() { do_action( 'roots_loop_before' ); }
|
function roots_loop_before() { do_action('roots_loop_before'); }
|
||||||
function roots_loop_after() { do_action( 'roots_loop_after' ); }
|
function roots_loop_after() { do_action('roots_loop_after'); }
|
||||||
function roots_sidebar_before() { do_action( 'roots_sidebar_before' ); }
|
function roots_sidebar_before() { do_action('roots_sidebar_before'); }
|
||||||
function roots_sidebar_inside_before() { do_action( 'roots_sidebar_inside_before' ); }
|
function roots_sidebar_inside_before() { do_action('roots_sidebar_inside_before'); }
|
||||||
function roots_sidebar_inside_after() { do_action( 'roots_sidebar_inside_after' ); }
|
function roots_sidebar_inside_after() { do_action('roots_sidebar_inside_after'); }
|
||||||
function roots_sidebar_after() { do_action( 'roots_sidebar_after' ); }
|
function roots_sidebar_after() { do_action('roots_sidebar_after'); }
|
||||||
|
|
||||||
// footer.php
|
// footer.php
|
||||||
function roots_footer_before() { do_action( 'roots_footer_before' ); }
|
function roots_footer_before() { do_action('roots_footer_before'); }
|
||||||
function roots_footer_inside() { do_action( 'roots_footer_inside' ); }
|
function roots_footer_inside() { do_action('roots_footer_inside'); }
|
||||||
function roots_footer_after() { do_action( 'roots_footer_after' ); }
|
function roots_footer_after() { do_action('roots_footer_after'); }
|
||||||
function roots_footer() { do_action( 'roots_footer' ); }
|
function roots_footer() { do_action('roots_footer'); }
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user