Add searchform partial and function to replace (and maintain) default WordPress functionality

This commit is contained in:
MWDelaney
2018-08-05 12:07:32 -04:00
parent a9312c0633
commit 1ccc2eed76
2 changed files with 14 additions and 0 deletions

View File

@@ -68,3 +68,10 @@ add_filter('comments_template', function ($comments_template) {
);
return template_path(locate_template(["views/{$comments_template}", $comments_template]) ?: $comments_template);
}, 100);
/**
* Render WordPress searchform using Blade
*/
add_filter('get_search_form', function () {
return template('partials.searchform');
});

View File

@@ -0,0 +1,7 @@
<form role="search" method="get" class="search-form" action="{{ esc_url( home_url( '/' ) ) }}">
<label>
<span class="screen-reader-text">{{ _x( 'Search for:', 'label' ) }}</span>
<input type="search" class="search-field" placeholder="{!! esc_attr_x( 'Search &hellip;', 'placeholder' ) !!}" value="{{ get_search_query() }}" name="s" />
</label>
<input type="submit" class="search-submit" value="{{ esc_attr_x( 'Search', 'submit button' ) }}" />
</form>