diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f28fdd..5a47d3b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
### HEAD
+* Change roots_sidebar into a more explicit configuration array
* Re-organize configuration/setup files
* Update to jQuery 1.8.2
* Refactor/simplify Roots vCard Widget
diff --git a/base.php b/base.php
index dc4c79b..02e31ed 100644
--- a/base.php
+++ b/base.php
@@ -17,7 +17,7 @@
-
+
diff --git a/doc/lib.md b/doc/lib.md
index b173127..153991e 100644
--- a/doc/lib.md
+++ b/doc/lib.md
@@ -67,6 +67,10 @@ This file is a placeholder for you to put in [custom post types](http://codex.wo
This file handles all of the CSS and JavaScript.
+### sidebar.php
+
+Class which provides a simple configuration interface to define what pages you want to show the sidebar on.
+
#### Stylesheets
Stylesheets are enqueued in the following order:
diff --git a/functions.php b/functions.php
index 9fde0de..c2a1d0e 100644
--- a/functions.php
+++ b/functions.php
@@ -7,6 +7,7 @@
require_once locate_template('/lib/utils.php'); // Utility functions
require_once locate_template('/lib/init.php'); // Initial theme setup and constants
+require_once locate_template('/lib/sidebar.php'); // Sidebar class
require_once locate_template('/lib/config.php'); // Configuration
require_once locate_template('/lib/activation.php'); // Theme activation
require_once locate_template('/lib/cleanup.php'); // Cleanup
diff --git a/lib/config.php b/lib/config.php
index 165001b..8e8640d 100644
--- a/lib/config.php
+++ b/lib/config.php
@@ -9,18 +9,37 @@ add_theme_support('rewrite-urls'); // Enable URL rewrites
add_theme_support('h5bp-htaccess'); // Enable HTML5 Boilerplate's .htaccess
add_theme_support('bootstrap-top-navbar'); // Enable Bootstrap's fixed navbar
-// Define which pages shouldn't have the sidebar
-function roots_sidebar() {
- if (is_404() || is_page_template('page-custom.php')) {
- return false;
- } else {
- return true;
- }
+
+/**
+ * Define which pages shouldn't have the sidebar
+ *
+ * See lib/sidebar.php for more details
+ */
+function roots_display_sidebar() {
+ $sidebar_config = new Roots_Sidebar(
+ /**
+ * Conditional tag checks (http://codex.wordpress.org/Conditional_Tags)
+ * Any of these conditional tags that return true won't show the sidebar
+ */
+ array(
+ 'is_404',
+ 'is_front_page'
+ ),
+ /**
+ * Page template checks (via is_page_template())
+ * Any of these page templates that return true won't show the sidebar
+ */
+ array(
+ 'page-custom.php'
+ )
+ );
+
+ return $sidebar_config->display;
}
// #main CSS classes
function roots_main_class() {
- if (roots_sidebar()) {
+ if (roots_display_sidebar()) {
echo 'span8';
} else {
echo 'span12';
diff --git a/lib/sidebar.php b/lib/sidebar.php
new file mode 100644
index 0000000..26c4e00
--- /dev/null
+++ b/lib/sidebar.php
@@ -0,0 +1,39 @@
+conditionals = $conditionals;
+ $this->templates = $templates;
+
+ $conditionals = array_map(array($this, 'check_conditional_tag'), $this->conditionals);
+ $templates = array_map(array($this, 'check_page_template'), $this->templates);
+
+ if (in_array(true, $conditionals) || in_array(true, $templates)) {
+ $this->display = false;
+ }
+ }
+
+ private function check_conditional_tag($conditional_tag) {
+ return $conditional_tag();
+ }
+
+ private function check_page_template($page_template) {
+ return is_page_template($page_template);
+ }
+}
+?>