Use Sass to style search form, remove search template

This commit is contained in:
Ben Word
2015-09-22 21:06:51 -05:00
parent 2be91c1b5e
commit 9a14571814
5 changed files with 16 additions and 24 deletions

View File

@@ -0,0 +1,15 @@
// Search form
.search-form {
@extend .form-inline;
}
.search-form label {
font-weight: normal;
@extend .form-group;
}
.search-form .search-field {
@extend .form-control;
}
.search-form .search-submit {
@extend .btn;
@extend .btn-default;
}

View File

@@ -10,7 +10,6 @@
* @link https://github.com/roots/sage/pull/1042
*/
$sage_includes = [
'lib/utils.php', // Utility functions
'lib/init.php', // Initial theme setup and constants
'lib/wrapper.php', // Theme wrapper class
'lib/config.php', // Configuration

View File

@@ -34,7 +34,7 @@ function setup() {
// Add HTML5 markup for captions
// http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery']);
add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']);
// Tell the TinyMCE editor to use a custom stylesheet
add_editor_style(Assets\asset_path('styles/editor-style.css'));

View File

@@ -1,13 +0,0 @@
<?php
namespace Roots\Sage\Utils;
/**
* Tell WordPress to use searchform.php from the templates/ directory
*/
function get_search_form() {
$form = '';
locate_template('/templates/searchform.php', true, false);
return $form;
}
add_filter('get_search_form', __NAMESPACE__ . '\\get_search_form');

View File

@@ -1,9 +0,0 @@
<form role="search" method="get" class="search-form form-inline" action="<?= esc_url(home_url('/')); ?>">
<label class="sr-only"><?php _e('Search for:', 'sage'); ?></label>
<div class="input-group">
<input type="search" value="<?= get_search_query(); ?>" name="s" class="search-field form-control" placeholder="<?php _e('Search', 'sage'); ?> <?php bloginfo('name'); ?>" required>
<span class="input-group-btn">
<button type="submit" class="search-submit btn btn-default"><?php _e('Search', 'sage'); ?></button>
</span>
</div>
</form>