From 433ad26e4d02a570ed2ef6cc04f9ea24bafc79f4 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Sun, 27 Jan 2013 20:42:40 -0600 Subject: [PATCH] Close #638 - Add add_theme_support for Nice Search --- CHANGELOG.md | 1 + doc/lib.md | 1 + lib/cleanup.php | 4 +++- lib/config.php | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5fe5e5..baf1eb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ### HEAD +* Enable `add_theme_support` for Nice Search * Replace ID's with classes * Add support for dynamic sidebar templates * Fix PHP notice on search with no results diff --git a/doc/lib.md b/doc/lib.md index 73c3cd1..188ddff 100644 --- a/doc/lib.md +++ b/doc/lib.md @@ -23,6 +23,7 @@ This file is used to enable various theme features, define which pages get the s 2. [Rewrites](rewrites.md) 3. HTML5 Boilerplate's `.htaccess` 4. Bootstrap's top navbar +5. Nice Search (redirect `/?s=` to `/search/`) If you don't want to use one of the features, either comment out the line or remove it. diff --git a/lib/cleanup.php b/lib/cleanup.php index 72edb5a..4e83cbf 100644 --- a/lib/cleanup.php +++ b/lib/cleanup.php @@ -488,7 +488,9 @@ function roots_nice_search_redirect() { } } -add_action('template_redirect', 'roots_nice_search_redirect'); +if (current_theme_supports('nice-search')) { + add_action('template_redirect', 'roots_nice_search_redirect'); +} /** * Fix for empty search queries redirecting to home page diff --git a/lib/config.php b/lib/config.php index 6b9ec43..2aed0b8 100644 --- a/lib/config.php +++ b/lib/config.php @@ -8,6 +8,7 @@ add_theme_support('root-relative-urls'); // Enable relative URLs 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 +add_theme_support('nice-search'); // Enable /?s= to /search/ redirect /**