From 85596e11d0f9aff85b501967c124b1c8bee20a6a Mon Sep 17 00:00:00 2001 From: Scott Walkinshaw Date: Thu, 20 Sep 2012 16:47:23 -0600 Subject: [PATCH] Clarity over cleverness --- lib/config.php | 6 +++--- lib/sidebar.php | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/config.php b/lib/config.php index 48eff61..9ab33df 100644 --- a/lib/config.php +++ b/lib/config.php @@ -22,15 +22,15 @@ function roots_display_sidebar() { * Any of these conditional tags that return true won't show the sidebar */ array( - '404', - 'front_page' + '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' + 'page-custom.php' ) ); diff --git a/lib/sidebar.php b/lib/sidebar.php index a8baf32..93d821c 100644 --- a/lib/sidebar.php +++ b/lib/sidebar.php @@ -4,14 +4,13 @@ * * If any of the is_* conditional tags or is_page_template(template_file) checks return true, the sidebar will NOT be displayed. * - * @param array list of conditional tags (http://codex.wordpress.org/Conditional_Tags) without the 'is_' prefix - * @param array list of templates without the '.php' extension. These will be checked via is_page_template() + * @param array list of conditional tags (http://codex.wordpress.org/Conditional_Tags) + * @param array list of page templates. These will be checked via is_page_template() * * @return boolean True will display the sidebar, False will not * */ class Roots_Sidebar { - const EXTENSION = '.php'; private $conditionals; private $templates; public $display = true; @@ -34,12 +33,11 @@ class Roots_Sidebar { } private function check_conditional_tag($conditional_tag) { - $conditional_tag_function = "is_$conditional_tag"; - return $conditional_tag_function(); + return $conditional_tag(); } private function check_page_template($page_template) { - return is_page_template($page_template . self::EXTENSION); + return is_page_template($page_template); } } ?>