doing some clean up to the new options (which are awesome btw)
This commit is contained in:
2
404.php
2
404.php
@@ -1,6 +1,6 @@
|
|||||||
<?php get_header(); ?>
|
<?php get_header(); ?>
|
||||||
<?php roots_content_before(); ?>
|
<?php roots_content_before(); ?>
|
||||||
<div id="content" class="<?php echo roots_container_class; ?>">
|
<div id="content" class="<?php echo $roots_options['container_class']; ?>">
|
||||||
<?php roots_main_before(); ?>
|
<?php roots_main_before(); ?>
|
||||||
<div id="main" role="main">
|
<div id="main" role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php get_header(); ?>
|
<?php get_header(); ?>
|
||||||
<?php roots_content_before(); ?>
|
<?php roots_content_before(); ?>
|
||||||
<div id="content" class="<?php echo roots_container_class; ?>">
|
<div id="content" class="<?php echo $roots_options['container_class']; ?>">
|
||||||
<?php roots_main_before(); ?>
|
<?php roots_main_before(); ?>
|
||||||
<div id="main" class="<?php echo $options['css_main_class']; ?>" role="main">
|
<div id="main" class="<?php echo $roots_options['main_class']; ?>" role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1><?php single_cat_title(); ?></h1>
|
<h1><?php single_cat_title(); ?></h1>
|
||||||
<?php roots_loop_before(); ?>
|
<?php roots_loop_before(); ?>
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
</div><!-- /#main -->
|
</div><!-- /#main -->
|
||||||
<?php roots_main_after(); ?>
|
<?php roots_main_after(); ?>
|
||||||
<?php roots_sidebar_before(); ?>
|
<?php roots_sidebar_before(); ?>
|
||||||
<aside id="sidebar" class="<?php echo $options['css_sidebar_class']; ?>" role="complementary">
|
<aside id="sidebar" class="<?php echo $roots_options['sidebar_class']; ?>" role="complementary">
|
||||||
<?php roots_sidebar_inside_before(); ?>
|
<?php roots_sidebar_inside_before(); ?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php get_sidebar(); ?>
|
<?php get_sidebar(); ?>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php roots_footer_before(); ?>
|
<?php roots_footer_before(); ?>
|
||||||
<footer id="content-info" class="<?php echo roots_container_class; ?>" role="contentinfo">
|
<footer id="content-info" class="<?php global $roots_options; echo $roots_options['container_class']; ?>" role="contentinfo">
|
||||||
<?php roots_footer_inside(); ?>
|
<?php roots_footer_inside(); ?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Footer") ) : ?>
|
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Footer") ) : ?>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<?php get_header(); ?>
|
<?php get_header(); ?>
|
||||||
<?php roots_content_before(); ?>
|
<?php roots_content_before(); ?>
|
||||||
<div id="content" class="<?php echo roots_container_class; ?>">
|
<div id="content" class="<?php echo $roots_options['container_class']; ?>">
|
||||||
<?php roots_main_before(); ?>
|
<?php roots_main_before(); ?>
|
||||||
<div id="main" class="<?php echo $options['css_main_class']; ?>" role="main">
|
<div id="main" class="<?php echo $roots_options['main_class']; ?>" role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php get_template_part('loop', 'page'); ?>
|
<?php get_template_part('loop', 'page'); ?>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /#main -->
|
</div><!-- /#main -->
|
||||||
<?php roots_main_after(); ?>
|
<?php roots_main_after(); ?>
|
||||||
<?php roots_sidebar_before(); ?>
|
<?php roots_sidebar_before(); ?>
|
||||||
<aside id="sidebar" class="<?php echo $options['css_sidebar_class']; ?>" role="complementary">
|
<aside id="sidebar" class="<?php echo $roots_options['sidebar_class']; ?>" role="complementary">
|
||||||
<?php roots_sidebar_inside_before(); ?>
|
<?php roots_sidebar_inside_before(); ?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php get_sidebar(); ?>
|
<?php get_sidebar(); ?>
|
||||||
|
|||||||
@@ -10,28 +10,15 @@ locate_template(array('inc/roots-actions.php'), true, true); // actions
|
|||||||
locate_template(array('inc/roots-widgets.php'), true, true); // widgets
|
locate_template(array('inc/roots-widgets.php'), true, true); // widgets
|
||||||
locate_template(array('inc/roots-custom.php'), true, true); // custom functions
|
locate_template(array('inc/roots-custom.php'), true, true); // custom functions
|
||||||
|
|
||||||
|
$roots_options = roots_get_theme_options();
|
||||||
|
|
||||||
// get active theme directory name
|
// get active theme directory name
|
||||||
// this allows you to rename the theme directory without breaking anything
|
// this allows you to rename the theme directory without breaking anything
|
||||||
$theme_name = next(explode('/themes/', get_template_directory()));
|
$theme_name = next(explode('/themes/', get_template_directory()));
|
||||||
|
|
||||||
// set the value of the main container class depending on the selected grid framework
|
|
||||||
$options = roots_get_theme_options();
|
|
||||||
$roots_css_framework = $options['css_grid_framework'];
|
|
||||||
if (!defined('roots_container_class')) {
|
|
||||||
switch ($roots_css_framework) {
|
|
||||||
case 'blueprint': define('roots_container_class', 'span-24'); break;
|
|
||||||
case '960gs_12': define('roots_container_class', 'container_12'); break;
|
|
||||||
case '960gs_16': define('roots_container_class', 'container_16'); break;
|
|
||||||
case '960gs_24': define('roots_container_class', 'container_24'); break;
|
|
||||||
case '1140': define('roots_container_class', 'container'); break;
|
|
||||||
case 'adapt': define('roots_container_class', 'container_12 clearfix'); break;
|
|
||||||
default: define('roots_container_class', ''); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_roots_stylesheets() {
|
function get_roots_stylesheets() {
|
||||||
$options = roots_get_theme_options();
|
global $roots_options;
|
||||||
$roots_css_framework = $options['css_grid_framework'];
|
$roots_css_framework = $roots_options['css_framework'];
|
||||||
|
|
||||||
$template_uri = get_template_directory_uri();
|
$template_uri = get_template_directory_uri();
|
||||||
$styles = '';
|
$styles = '';
|
||||||
@@ -72,6 +59,8 @@ function get_roots_stylesheets() {
|
|||||||
|
|
||||||
// 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;
|
||||||
|
$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;
|
||||||
@@ -100,14 +89,6 @@ register_nav_menus(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// remove container from menus
|
|
||||||
function roots_nav_menu_args($args = '') {
|
|
||||||
$args['container'] = false;
|
|
||||||
return $args;
|
|
||||||
}
|
|
||||||
|
|
||||||
add_filter('wp_nav_menu_args', 'roots_nav_menu_args');
|
|
||||||
|
|
||||||
// create widget areas: sidebar, footer
|
// create widget areas: sidebar, footer
|
||||||
$sidebars = array('Sidebar', 'Footer');
|
$sidebars = array('Sidebar', 'Footer');
|
||||||
foreach ($sidebars as $sidebar) {
|
foreach ($sidebars as $sidebar) {
|
||||||
|
|||||||
@@ -24,12 +24,12 @@
|
|||||||
|
|
||||||
<script src="<?php echo get_template_directory_uri(); ?>/js/scripts.js"></script>
|
<script src="<?php echo get_template_directory_uri(); ?>/js/scripts.js"></script>
|
||||||
<?php
|
<?php
|
||||||
$options = roots_get_theme_options();
|
global $roots_options;
|
||||||
$google_analytics_id = $options['google_analytics_id'];
|
$google_analytics_id = $roots_options['google_analytics_id'];
|
||||||
if ($google_analytics_id !== '') { ?>
|
if ($google_analytics_id !== '') { ?>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var _gaq=[['_setAccount','<?php echo esc_attr($options['google_analytics_id']); ?>'],['_trackPageview'],['_trackPageLoadTime']];
|
var _gaq=[['_setAccount','<?php echo esc_attr($roots_options['google_analytics_id']); ?>'],['_trackPageview'],['_trackPageLoadTime']];
|
||||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
|
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
|
||||||
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
||||||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
<?php roots_wrap_before(); ?>
|
<?php roots_wrap_before(); ?>
|
||||||
<div id="wrap" class="container" role="document">
|
<div id="wrap" class="container" role="document">
|
||||||
<?php roots_header_before(); ?>
|
<?php roots_header_before(); ?>
|
||||||
<header id="banner" class="<?php echo roots_container_class; ?>" role="banner">
|
<header id="banner" class="<?php global $roots_options; echo $roots_options['container_class']; ?>" role="banner">
|
||||||
<?php roots_header_inside(); ?>
|
<?php roots_header_inside(); ?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a id="logo" href="<?php echo home_url(); ?>/"><img src="<?php echo get_template_directory_uri(); ?>/img/logo.png" width="300" height="75" alt="<?php bloginfo('name'); ?>"></a>
|
<a id="logo" href="<?php echo home_url(); ?>/"><img src="<?php echo get_template_directory_uri(); ?>/img/logo.png" width="300" height="75" alt="<?php bloginfo('name'); ?>"></a>
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ add_action('roots_footer_after', 'roots_1140_footer_after');
|
|||||||
add_action('roots_post_inside_before', 'roots_page_breadcrumb');
|
add_action('roots_post_inside_before', 'roots_page_breadcrumb');
|
||||||
|
|
||||||
function roots_1140_head() {
|
function roots_1140_head() {
|
||||||
$options = roots_get_theme_options();
|
global $roots_options;
|
||||||
$roots_css_framework = $options['css_grid_framework'];
|
$roots_css_framework = $roots_options['css_framework'];
|
||||||
$template_uri = get_template_directory_uri();
|
$template_uri = get_template_directory_uri();
|
||||||
if ($roots_css_framework === '1140') {
|
if ($roots_css_framework === '1140') {
|
||||||
echo "<script src=\"$template_uri/js/libs/css3-mediaqueries.js\"></script>";
|
echo "<script src=\"$template_uri/js/libs/css3-mediaqueries.js\"></script>";
|
||||||
@@ -18,8 +18,8 @@ function roots_1140_head() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function roots_adapt_head() {
|
function roots_adapt_head() {
|
||||||
$options = roots_get_theme_options();
|
global $roots_options;
|
||||||
$roots_css_framework = $options['css_grid_framework'];
|
$roots_css_framework = $roots_options['css_framework'];
|
||||||
$template_uri = get_template_directory_uri();
|
$template_uri = get_template_directory_uri();
|
||||||
if ($roots_css_framework === 'adapt') {
|
if ($roots_css_framework === 'adapt') {
|
||||||
echo "<script>\n";
|
echo "<script>\n";
|
||||||
@@ -41,16 +41,16 @@ function roots_adapt_head() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function roots_1140_header_before() {
|
function roots_1140_header_before() {
|
||||||
$options = roots_get_theme_options();
|
global $roots_options;
|
||||||
$roots_css_framework = $options['css_grid_framework'];
|
$roots_css_framework = $roots_options['css_framework'];
|
||||||
if ($roots_css_framework === '1140') {
|
if ($roots_css_framework === '1140') {
|
||||||
echo "<div class=\"row\">";
|
echo "<div class=\"row\">";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function roots_1140_header_after() {
|
function roots_1140_header_after() {
|
||||||
$options = roots_get_theme_options();
|
global $roots_options;
|
||||||
$roots_css_framework = $options['css_grid_framework'];
|
$roots_css_framework = $roots_options['css_framework'];
|
||||||
if ($roots_css_framework === '1140') {
|
if ($roots_css_framework === '1140') {
|
||||||
echo "</div><!-- /.row -->";
|
echo "</div><!-- /.row -->";
|
||||||
echo "<div class=\"row\">";
|
echo "<div class=\"row\">";
|
||||||
@@ -58,8 +58,8 @@ function roots_1140_header_after() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function roots_1140_footer_before() {
|
function roots_1140_footer_before() {
|
||||||
$options = roots_get_theme_options();
|
global $roots_options;
|
||||||
$roots_css_framework = $options['css_grid_framework'];
|
$roots_css_framework = $roots_options['css_framework'];
|
||||||
if ($roots_css_framework === '1140') {
|
if ($roots_css_framework === '1140') {
|
||||||
echo "</div><!-- /.row -->";
|
echo "</div><!-- /.row -->";
|
||||||
echo "<div class=\"row\">";
|
echo "<div class=\"row\">";
|
||||||
@@ -67,8 +67,8 @@ function roots_1140_footer_before() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function roots_1140_footer_after() {
|
function roots_1140_footer_after() {
|
||||||
$options = roots_get_theme_options();
|
global $roots_options;
|
||||||
$roots_css_framework = $options['css_grid_framework'];
|
$roots_css_framework = $roots_options['css_framework'];
|
||||||
if ($roots_css_framework === '1140') {
|
if ($roots_css_framework === '1140') {
|
||||||
echo "</div><!-- /.row -->";
|
echo "</div><!-- /.row -->";
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,6 @@ function roots_page_breadcrumb() {
|
|||||||
yoast_breadcrumb('<p id="breadcrumbs">','</p>');
|
yoast_breadcrumb('<p id="breadcrumbs">','</p>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wp_reset_postdata();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -132,13 +132,37 @@ function roots_language_attributes() {
|
|||||||
|
|
||||||
add_filter('language_attributes', 'roots_language_attributes');
|
add_filter('language_attributes', 'roots_language_attributes');
|
||||||
|
|
||||||
|
|
||||||
// remove WordPress version from RSS feed
|
// remove WordPress version from RSS feed
|
||||||
function roots_no_generator() { return ''; }
|
function roots_no_generator() { return ''; }
|
||||||
add_filter('the_generator', 'roots_no_generator');
|
add_filter('the_generator', 'roots_no_generator');
|
||||||
|
|
||||||
|
|
||||||
// cleanup wp_head
|
// cleanup wp_head
|
||||||
|
function roots_noindex() {
|
||||||
|
if ('0' == get_option('blog_public'))
|
||||||
|
echo "<meta name=\"robots\" content=\"noindex,nofollow\">\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
function roots_rel_canonical() {
|
||||||
|
if (!is_singular())
|
||||||
|
return;
|
||||||
|
global $wp_the_query;
|
||||||
|
if (!$id = $wp_the_query->get_queried_object_id())
|
||||||
|
return;
|
||||||
|
$link = get_permalink($id);
|
||||||
|
echo "<link rel=\"canonical\" href=\"$link\">\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove CSS from recent comments widget
|
||||||
|
function roots_remove_recent_comments_style() {
|
||||||
|
global $wp_widget_factory;
|
||||||
|
remove_action( 'wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style') );
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove CSS from gallery
|
||||||
|
function roots_gallery_style($css) {
|
||||||
|
return preg_replace("#<style type='text/css'>(.*?)</style>#s", '', $css);
|
||||||
|
}
|
||||||
|
|
||||||
function roots_head_cleanup() {
|
function roots_head_cleanup() {
|
||||||
// http://wpengineer.com/1438/wordpress-header/
|
// http://wpengineer.com/1438/wordpress-header/
|
||||||
remove_action('wp_head', 'feed_links', 2);
|
remove_action('wp_head', 'feed_links', 2);
|
||||||
@@ -151,25 +175,12 @@ function roots_head_cleanup() {
|
|||||||
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
|
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
|
||||||
remove_action('wp_head', 'wp_generator');
|
remove_action('wp_head', 'wp_generator');
|
||||||
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
|
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
|
||||||
|
|
||||||
remove_action('wp_head', 'noindex', 1);
|
remove_action('wp_head', 'noindex', 1);
|
||||||
function roots_noindex() {
|
|
||||||
if ('0' == get_option('blog_public'))
|
|
||||||
echo "<meta name=\"robots\" content=\"noindex,nofollow\">\n";
|
|
||||||
}
|
|
||||||
add_action('wp_head', 'roots_noindex');
|
add_action('wp_head', 'roots_noindex');
|
||||||
|
|
||||||
remove_action('wp_head', 'rel_canonical');
|
remove_action('wp_head', 'rel_canonical');
|
||||||
function roots_rel_canonical() {
|
add_action('wp_head', 'roots_rel_canonical');
|
||||||
if (!is_singular())
|
add_action('wp_head', 'roots_remove_recent_comments_style', 1);
|
||||||
return;
|
add_filter('gallery_style', 'roots_gallery_style');
|
||||||
global $wp_the_query;
|
|
||||||
if (!$id = $wp_the_query->get_queried_object_id())
|
|
||||||
return;
|
|
||||||
$link = get_permalink($id);
|
|
||||||
echo "<link rel=\"canonical\" href=\"$link\">\n";
|
|
||||||
}
|
|
||||||
add_action('wp_head', 'roots_rel_canonical');
|
|
||||||
|
|
||||||
// stop Gravity Forms from outputting CSS since it's linked in header.php
|
// stop Gravity Forms from outputting CSS since it's linked in header.php
|
||||||
if (class_exists('RGForms')) {
|
if (class_exists('RGForms')) {
|
||||||
@@ -187,28 +198,11 @@ function roots_head_cleanup() {
|
|||||||
wp_deregister_script('jquery');
|
wp_deregister_script('jquery');
|
||||||
wp_register_script('jquery', '', '', '', true);
|
wp_register_script('jquery', '', '', '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove CSS from recent comments widget
|
|
||||||
function roots_recent_comments_style() {
|
|
||||||
global $wp_widget_factory;
|
|
||||||
remove_action( 'wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style') );
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('wp_head', 'roots_recent_comments_style', 1);
|
|
||||||
|
|
||||||
// remove CSS from gallery
|
|
||||||
function roots_gallery_style($css) {
|
|
||||||
return preg_replace("#<style type='text/css'>(.*?)</style>#s", '', $css);
|
|
||||||
}
|
|
||||||
|
|
||||||
add_filter('gallery_style', 'roots_gallery_style');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('init', 'roots_head_cleanup');
|
add_action('init', 'roots_head_cleanup');
|
||||||
|
|
||||||
// cleanup gallery_shortcode()
|
// cleanup gallery_shortcode()
|
||||||
remove_shortcode('gallery');
|
|
||||||
|
|
||||||
function roots_gallery_shortcode($attr) {
|
function roots_gallery_shortcode($attr) {
|
||||||
global $post, $wp_locale;
|
global $post, $wp_locale;
|
||||||
|
|
||||||
@@ -309,9 +303,9 @@ function roots_gallery_shortcode($attr) {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_shortcode('gallery');
|
||||||
add_shortcode('gallery', 'roots_gallery_shortcode');
|
add_shortcode('gallery', 'roots_gallery_shortcode');
|
||||||
|
|
||||||
|
|
||||||
// http://www.deluxeblogtips.com/2011/01/remove-dashboard-widgets-in-wordpress.html
|
// http://www.deluxeblogtips.com/2011/01/remove-dashboard-widgets-in-wordpress.html
|
||||||
function roots_remove_dashboard_widgets() {
|
function roots_remove_dashboard_widgets() {
|
||||||
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal');
|
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal');
|
||||||
@@ -338,4 +332,12 @@ function roots_auto_excerpt_more($more) {
|
|||||||
add_filter('excerpt_length', 'roots_excerpt_length');
|
add_filter('excerpt_length', 'roots_excerpt_length');
|
||||||
add_filter('excerpt_more', 'roots_auto_excerpt_more');
|
add_filter('excerpt_more', 'roots_auto_excerpt_more');
|
||||||
|
|
||||||
|
// remove container from menus
|
||||||
|
function roots_nav_menu_args($args = '') {
|
||||||
|
$args['container'] = false;
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_filter('wp_nav_menu_args', 'roots_nav_menu_args');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ function roots_admin_enqueue_scripts($hook_suffix) {
|
|||||||
add_action('admin_enqueue_scripts', 'roots_admin_enqueue_scripts');
|
add_action('admin_enqueue_scripts', 'roots_admin_enqueue_scripts');
|
||||||
|
|
||||||
function roots_theme_options_init() {
|
function roots_theme_options_init() {
|
||||||
|
|
||||||
if (false === roots_get_theme_options())
|
if (false === roots_get_theme_options())
|
||||||
add_option('roots_theme_options', roots_get_default_theme_options());
|
add_option('roots_theme_options', roots_get_default_theme_options());
|
||||||
|
|
||||||
@@ -41,8 +40,8 @@ function roots_theme_options_add_page() {
|
|||||||
}
|
}
|
||||||
add_action('admin_menu', 'roots_theme_options_add_page');
|
add_action('admin_menu', 'roots_theme_options_add_page');
|
||||||
|
|
||||||
function roots_grid_framework() {
|
function roots_css_framework() {
|
||||||
$grid_options = array(
|
$framework_options = array(
|
||||||
'blueprint' => array(
|
'blueprint' => array(
|
||||||
'value' => 'blueprint',
|
'value' => 'blueprint',
|
||||||
'label' => __('Blueprint CSS', 'roots'),
|
'label' => __('Blueprint CSS', 'roots'),
|
||||||
@@ -69,14 +68,15 @@ function roots_grid_framework() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return apply_filters('roots_grid_framework', $grid_options);
|
return apply_filters('roots_css_framework', $framework_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
function roots_get_default_theme_options() {
|
function roots_get_default_theme_options() {
|
||||||
$default_theme_options = array(
|
$default_theme_options = array(
|
||||||
'css_grid_framework' => 'blueprint',
|
'css_framework' => 'blueprint',
|
||||||
'css_main_class' => 'span-14 append-1',
|
'container_class' => 'span-24',
|
||||||
'css_sidebar_class' => 'span-8 prepend-1 last',
|
'main_class' => 'span-14 append-1',
|
||||||
|
'sidebar_class' => 'span-8 prepend-1 last',
|
||||||
'google_analytics_id' => ''
|
'google_analytics_id' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -97,8 +97,8 @@ function theme_options_render_page() {
|
|||||||
<form method="post" action="options.php">
|
<form method="post" action="options.php">
|
||||||
<?php
|
<?php
|
||||||
settings_fields('roots_options');
|
settings_fields('roots_options');
|
||||||
$options = roots_get_theme_options();
|
$roots_options = roots_get_theme_options();
|
||||||
$default_options = roots_get_default_theme_options();
|
$roots_default_options = roots_get_default_theme_options();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<table class="form-table">
|
<table class="form-table">
|
||||||
@@ -107,13 +107,13 @@ function theme_options_render_page() {
|
|||||||
<td>
|
<td>
|
||||||
<fieldset><legend class="screen-reader-text"><span><?php _e('CSS Grid Framework', 'roots'); ?></span></legend>
|
<fieldset><legend class="screen-reader-text"><span><?php _e('CSS Grid Framework', 'roots'); ?></span></legend>
|
||||||
<?php
|
<?php
|
||||||
foreach (roots_grid_framework() as $grid_framework) {
|
foreach (roots_css_framework() as $css_framework) {
|
||||||
?>
|
?>
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<label class="description">
|
<label class="description">
|
||||||
<input type="radio" name="roots_theme_options[css_grid_framework]" value="<?php echo esc_attr($grid_framework['value']); ?>" <?php checked($options['css_grid_framework'], $grid_framework['value']); ?> />
|
<input type="radio" name="roots_theme_options[css_framework]" value="<?php echo esc_attr($css_framework['value']); ?>" <?php checked($roots_options['css_framework'], $css_framework['value']); ?> />
|
||||||
<span>
|
<span>
|
||||||
<?php echo $grid_framework['label']; ?>
|
<?php echo $css_framework['label']; ?>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -127,9 +127,9 @@ function theme_options_render_page() {
|
|||||||
<tr valign="top"><th scope="row"><?php _e('#main CSS Classes', 'roots'); ?></th>
|
<tr valign="top"><th scope="row"><?php _e('#main CSS Classes', 'roots'); ?></th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset><legend class="screen-reader-text"><span><?php _e('#main CSS Classes', 'roots'); ?></span></legend>
|
<fieldset><legend class="screen-reader-text"><span><?php _e('#main CSS Classes', 'roots'); ?></span></legend>
|
||||||
<input type="text" name="roots_theme_options[css_main_class]" id="css_main_class" value="<?php echo esc_attr($options['css_main_class']); ?>" class="regular-text" />
|
<input type="text" name="roots_theme_options[main_class]" id="main_class" value="<?php echo esc_attr($roots_options['main_class']); ?>" class="regular-text" />
|
||||||
<br />
|
<br />
|
||||||
<small class="description"><?php printf( __('Default: %s', 'roots'), $default_options['css_main_class']); ?></small>
|
<small class="description"><?php printf( __('Default: %s', 'roots'), $roots_default_options['main_class']); ?></small>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -137,9 +137,9 @@ function theme_options_render_page() {
|
|||||||
<tr valign="top"><th scope="row"><?php _e('#sidebar CSS Classes', 'roots'); ?></th>
|
<tr valign="top"><th scope="row"><?php _e('#sidebar CSS Classes', 'roots'); ?></th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset><legend class="screen-reader-text"><span><?php _e('#sidebar CSS Classes', 'roots'); ?></span></legend>
|
<fieldset><legend class="screen-reader-text"><span><?php _e('#sidebar CSS Classes', 'roots'); ?></span></legend>
|
||||||
<input type="text" name="roots_theme_options[css_sidebar_class]" id="css_sidebar_class" value="<?php echo esc_attr($options['css_sidebar_class']); ?>" class="regular-text" />
|
<input type="text" name="roots_theme_options[sidebar_class]" id="sidebar_class" value="<?php echo esc_attr($roots_options['sidebar_class']); ?>" class="regular-text" />
|
||||||
<br />
|
<br />
|
||||||
<small class="description"><?php printf( __('Default: %s', 'roots'), $default_options['css_sidebar_class']); ?></small>
|
<small class="description"><?php printf( __('Default: %s', 'roots'), $roots_default_options['sidebar_class']); ?></small>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -147,7 +147,7 @@ function theme_options_render_page() {
|
|||||||
<tr valign="top"><th scope="row"><?php _e('Google Analytics ID', 'roots'); ?></th>
|
<tr valign="top"><th scope="row"><?php _e('Google Analytics ID', 'roots'); ?></th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset><legend class="screen-reader-text"><span><?php _e('Google Analytics ID', 'roots'); ?></span></legend>
|
<fieldset><legend class="screen-reader-text"><span><?php _e('Google Analytics ID', 'roots'); ?></span></legend>
|
||||||
<input type="text" name="roots_theme_options[google_analytics_id]" id="google_analytics_id" value="<?php echo esc_attr($options['google_analytics_id']); ?>" />
|
<input type="text" name="roots_theme_options[google_analytics_id]" id="google_analytics_id" value="<?php echo esc_attr($roots_options['google_analytics_id']); ?>" />
|
||||||
<br />
|
<br />
|
||||||
<small class="description"><?php printf(__('Enter your UA-XXXXX-X ID', 'roots')); ?></small>
|
<small class="description"><?php printf(__('Enter your UA-XXXXX-X ID', 'roots')); ?></small>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -165,15 +165,35 @@ function theme_options_render_page() {
|
|||||||
|
|
||||||
function roots_theme_options_validate($input) {
|
function roots_theme_options_validate($input) {
|
||||||
$output = $defaults = roots_get_default_theme_options();
|
$output = $defaults = roots_get_default_theme_options();
|
||||||
|
|
||||||
|
if (isset($input['css_framework']) && array_key_exists($input['css_framework'], roots_css_framework()))
|
||||||
|
$output['css_framework'] = $input['css_framework'];
|
||||||
|
|
||||||
|
// set the value of the main container class depending on the selected grid framework
|
||||||
|
if ($output['css_framework'] = 'blueprint') {
|
||||||
|
$output['container_class'] = 'span-24';
|
||||||
|
}
|
||||||
|
if ($output['css_framework'] = '960gs_12') {
|
||||||
|
$output['container_class'] = 'container_12';
|
||||||
|
}
|
||||||
|
if ($output['css_framework'] = '960gs_16') {
|
||||||
|
$output['container_class'] = 'container_16';
|
||||||
|
}
|
||||||
|
if ($output['css_framework'] = '960gs_24') {
|
||||||
|
$output['container_class'] = 'container_24';
|
||||||
|
}
|
||||||
|
if ($output['css_framework'] = '1140') {
|
||||||
|
$output['container_class'] = 'container';
|
||||||
|
}
|
||||||
|
if ($output['css_framework'] = 'adapt') {
|
||||||
|
$output['container_class'] = 'container_12 clearfix';
|
||||||
|
}
|
||||||
|
|
||||||
if (isset( $input['css_grid_framework']) && array_key_exists($input['css_grid_framework'], roots_grid_framework()))
|
if (isset($input['main_class']))
|
||||||
$output['css_grid_framework'] = $input['css_grid_framework'];
|
$output['main_class'] = $input['main_class'];
|
||||||
|
|
||||||
if (isset($input['css_main_class']))
|
if (isset($input['sidebar_class']))
|
||||||
$output['css_main_class'] = $input['css_main_class'];
|
$output['sidebar_class'] = $input['sidebar_class'];
|
||||||
|
|
||||||
if (isset($input['css_sidebar_class']))
|
|
||||||
$output['css_sidebar_class'] = $input['css_sidebar_class'];
|
|
||||||
|
|
||||||
if (isset($input['google_analytics_id']))
|
if (isset($input['google_analytics_id']))
|
||||||
$output['google_analytics_id'] = $input['google_analytics_id'];
|
$output['google_analytics_id'] = $input['google_analytics_id'];
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php get_header(); ?>
|
<?php get_header(); ?>
|
||||||
<?php roots_content_before(); ?>
|
<?php roots_content_before(); ?>
|
||||||
<div id="content" class="<?php echo roots_container_class; ?>">
|
<div id="content" class="<?php echo $roots_options['container_class']; ?>">
|
||||||
<?php roots_main_before(); ?>
|
<?php roots_main_before(); ?>
|
||||||
<div id="main" class="<?php echo $options['css_main_class']; ?>" role="main">
|
<div id="main" class="<?php echo $roots_options['main_class']; ?>" role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1><?php _e('Latest Posts', 'roots');?></h1>
|
<h1><?php _e('Latest Posts', 'roots');?></h1>
|
||||||
<?php get_template_part('loop', 'index'); ?>
|
<?php get_template_part('loop', 'index'); ?>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
</div><!-- /#main -->
|
</div><!-- /#main -->
|
||||||
<?php roots_main_after(); ?>
|
<?php roots_main_after(); ?>
|
||||||
<?php roots_sidebar_before(); ?>
|
<?php roots_sidebar_before(); ?>
|
||||||
<aside id="sidebar" class="<?php echo $options['css_sidebar_class']; ?>" role="complementary">
|
<aside id="sidebar" class="<?php echo $roots_options['sidebar_class']; ?>" role="complementary">
|
||||||
<?php roots_sidebar_inside_before(); ?>
|
<?php roots_sidebar_inside_before(); ?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php get_sidebar(); ?>
|
<?php get_sidebar(); ?>
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ Template Name: Custom
|
|||||||
*/
|
*/
|
||||||
get_header(); ?>
|
get_header(); ?>
|
||||||
<?php roots_content_before(); ?>
|
<?php roots_content_before(); ?>
|
||||||
<div id="content" class="<?php echo roots_container_class; ?>">
|
<div id="content" class="<?php echo $roots_options['container_class']; ?>">
|
||||||
<?php roots_main_before(); ?>
|
<?php roots_main_before(); ?>
|
||||||
<div id="main" class="<?php echo $options['css_main_class']; ?>" role="main">
|
<div id="main" class="<?php echo $roots_options['main_class']; ?>" role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php roots_loop_before(); ?>
|
<?php roots_loop_before(); ?>
|
||||||
<?php get_template_part('loop', 'page'); ?>
|
<?php get_template_part('loop', 'page'); ?>
|
||||||
@@ -15,7 +15,7 @@ get_header(); ?>
|
|||||||
</div><!-- /#main -->
|
</div><!-- /#main -->
|
||||||
<?php roots_main_after(); ?>
|
<?php roots_main_after(); ?>
|
||||||
<?php roots_sidebar_before(); ?>
|
<?php roots_sidebar_before(); ?>
|
||||||
<aside id="sidebar" class="<?php echo $options['css_sidebar_class']; ?>" role="complementary">
|
<aside id="sidebar" class="<?php echo $roots_options['sidebar_class']; ?>" role="complementary">
|
||||||
<?php roots_sidebar_inside_before(); ?>
|
<?php roots_sidebar_inside_before(); ?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php get_sidebar(); ?>
|
<?php get_sidebar(); ?>
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ Template Name: Full Width
|
|||||||
*/
|
*/
|
||||||
get_header(); ?>
|
get_header(); ?>
|
||||||
<?php roots_content_before(); ?>
|
<?php roots_content_before(); ?>
|
||||||
<div id="content" class="<?php echo roots_container_class; ?>">
|
<div id="content" class="<?php echo $roots_options['container_class']; ?>">
|
||||||
<?php roots_main_before(); ?>
|
<?php roots_main_before(); ?>
|
||||||
<div id="main" class="<?php echo roots_container_class; ?>" role="main">
|
<div id="main" class="<?php echo $roots_options['container_class']; ?>" role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php roots_loop_before(); ?>
|
<?php roots_loop_before(); ?>
|
||||||
<?php get_template_part('loop', 'page'); ?>
|
<?php get_template_part('loop', 'page'); ?>
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ Template Name: Sitemap
|
|||||||
*/
|
*/
|
||||||
get_header(); ?>
|
get_header(); ?>
|
||||||
<?php roots_content_before(); ?>
|
<?php roots_content_before(); ?>
|
||||||
<div id="content" class="<?php echo roots_container_class; ?>">
|
<div id="content" class="<?php echo $roots_options['container_class']; ?>">
|
||||||
<?php roots_main_before(); ?>
|
<?php roots_main_before(); ?>
|
||||||
<div id="main" class="<?php echo $options['css_main_class']; ?>" role="main">
|
<div id="main" class="<?php echo $roots_options['main_class']; ?>" role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php roots_loop_before(); ?>
|
<?php roots_loop_before(); ?>
|
||||||
<?php get_template_part('loop', 'page'); ?>
|
<?php get_template_part('loop', 'page'); ?>
|
||||||
@@ -21,7 +21,7 @@ get_header(); ?>
|
|||||||
</div><!-- /#main -->
|
</div><!-- /#main -->
|
||||||
<?php roots_main_after(); ?>
|
<?php roots_main_after(); ?>
|
||||||
<?php roots_sidebar_before(); ?>
|
<?php roots_sidebar_before(); ?>
|
||||||
<aside id="sidebar" class="<?php echo $options['css_sidebar_class']; ?>" role="complementary">
|
<aside id="sidebar" class="<?php echo $roots_options['sidebar_class']; ?>" role="complementary">
|
||||||
<?php roots_sidebar_inside_before(); ?>
|
<?php roots_sidebar_inside_before(); ?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php get_sidebar(); ?>
|
<?php get_sidebar(); ?>
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ Template Name: List Subpages
|
|||||||
*/
|
*/
|
||||||
get_header(); ?>
|
get_header(); ?>
|
||||||
<?php roots_content_before(); ?>
|
<?php roots_content_before(); ?>
|
||||||
<div id="content" class="<?php echo roots_container_class; ?>">
|
<div id="content" class="<?php echo $roots_options['container_class']; ?>">
|
||||||
<?php roots_main_before(); ?>
|
<?php roots_main_before(); ?>
|
||||||
<div id="main" class="<?php echo $options['css_main_class']; ?>" role="main">
|
<div id="main" class="<?php echo $roots_options['main_class']; ?>" role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php roots_loop_before(); ?>
|
<?php roots_loop_before(); ?>
|
||||||
<?php get_template_part('loop', 'page'); ?>
|
<?php get_template_part('loop', 'page'); ?>
|
||||||
@@ -22,7 +22,7 @@ get_header(); ?>
|
|||||||
</div><!-- /#main -->
|
</div><!-- /#main -->
|
||||||
<?php roots_main_after(); ?>
|
<?php roots_main_after(); ?>
|
||||||
<?php roots_sidebar_before(); ?>
|
<?php roots_sidebar_before(); ?>
|
||||||
<aside id="sidebar" class="<?php echo $options['css_sidebar_class']; ?>" role="complementary">
|
<aside id="sidebar" class="<?php echo $roots_options['sidebar_class']; ?>" role="complementary">
|
||||||
<?php roots_sidebar_inside_before(); ?>
|
<?php roots_sidebar_inside_before(); ?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php get_sidebar(); ?>
|
<?php get_sidebar(); ?>
|
||||||
|
|||||||
6
page.php
6
page.php
@@ -1,8 +1,8 @@
|
|||||||
<?php get_header(); ?>
|
<?php get_header(); ?>
|
||||||
<?php roots_content_before(); ?>
|
<?php roots_content_before(); ?>
|
||||||
<div id="content" class="<?php echo roots_container_class; ?>">
|
<div id="content" class="<?php echo $roots_options['container_class']; ?>">
|
||||||
<?php roots_main_before(); ?>
|
<?php roots_main_before(); ?>
|
||||||
<div id="main" class="<?php echo $options['css_main_class']; ?>" role="main">
|
<div id="main" class="<?php echo $roots_options['main_class']; ?>" role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php roots_loop_before(); ?>
|
<?php roots_loop_before(); ?>
|
||||||
<?php get_template_part('loop', 'page'); ?>
|
<?php get_template_part('loop', 'page'); ?>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
</div><!-- /#main -->
|
</div><!-- /#main -->
|
||||||
<?php roots_main_after(); ?>
|
<?php roots_main_after(); ?>
|
||||||
<?php roots_sidebar_before(); ?>
|
<?php roots_sidebar_before(); ?>
|
||||||
<aside id="sidebar" class="<?php echo $options['css_sidebar_class']; ?>" role="complementary">
|
<aside id="sidebar" class="<?php echo $roots_options['sidebar_class']; ?>" role="complementary">
|
||||||
<?php roots_sidebar_inside_before(); ?>
|
<?php roots_sidebar_inside_before(); ?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php get_sidebar(); ?>
|
<?php get_sidebar(); ?>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php get_header(); ?>
|
<?php get_header(); ?>
|
||||||
<?php roots_content_before(); ?>
|
<?php roots_content_before(); ?>
|
||||||
<div id="content" class="<?php echo roots_container_class; ?>">
|
<div id="content" class="<?php echo $roots_options['container_class']; ?>">
|
||||||
<?php roots_main_before(); ?>
|
<?php roots_main_before(); ?>
|
||||||
<div id="main" class="<?php echo $options['css_main_class']; ?>" role="main">
|
<div id="main" class="<?php echo $roots_options['main_class']; ?>" role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1><?php _e('Search Results for', 'roots'); ?> <?php echo get_search_query(); ?></h1>
|
<h1><?php _e('Search Results for', 'roots'); ?> <?php echo get_search_query(); ?></h1>
|
||||||
<?php roots_loop_before(); ?>
|
<?php roots_loop_before(); ?>
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
</div><!-- /#main -->
|
</div><!-- /#main -->
|
||||||
<?php roots_main_after(); ?>
|
<?php roots_main_after(); ?>
|
||||||
<?php roots_sidebar_before(); ?>
|
<?php roots_sidebar_before(); ?>
|
||||||
<aside id="sidebar" class="<?php echo $options['css_sidebar_class']; ?>" role="complementary">
|
<aside id="sidebar" class="<?php echo $roots_options['sidebar_class']; ?>" role="complementary">
|
||||||
<?php roots_sidebar_inside_before(); ?>
|
<?php roots_sidebar_inside_before(); ?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php get_sidebar(); ?>
|
<?php get_sidebar(); ?>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php get_header(); ?>
|
<?php get_header(); ?>
|
||||||
<?php roots_content_before(); ?>
|
<?php roots_content_before(); ?>
|
||||||
<div id="content" class="<?php echo roots_container_class; ?>">
|
<div id="content" class="<?php echo $roots_options['container_class']; ?>">
|
||||||
<?php roots_main_before(); ?>
|
<?php roots_main_before(); ?>
|
||||||
<div id="main" class="<?php echo $options['css_main_class']; ?>" role="main">
|
<div id="main" class="<?php echo $roots_options['main_class']; ?>" role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php roots_loop_before(); ?>
|
<?php roots_loop_before(); ?>
|
||||||
<?php get_template_part('loop', 'single'); ?>
|
<?php get_template_part('loop', 'single'); ?>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
</div><!-- /#main -->
|
</div><!-- /#main -->
|
||||||
<?php roots_main_after(); ?>
|
<?php roots_main_after(); ?>
|
||||||
<?php roots_sidebar_before(); ?>
|
<?php roots_sidebar_before(); ?>
|
||||||
<aside id="sidebar" class="<?php echo $options['css_sidebar_class']; ?>" role="complementary">
|
<aside id="sidebar" class="<?php echo $roots_options['sidebar_class']; ?>" role="complementary">
|
||||||
<?php roots_sidebar_inside_before(); ?>
|
<?php roots_sidebar_inside_before(); ?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php get_sidebar(); ?>
|
<?php get_sidebar(); ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user