Add searchform partial and function to replace (and maintain) default WordPress functionality
This commit is contained in:
@@ -68,3 +68,10 @@ add_filter('comments_template', function ($comments_template) {
|
|||||||
);
|
);
|
||||||
return template_path(locate_template(["views/{$comments_template}", $comments_template]) ?: $comments_template);
|
return template_path(locate_template(["views/{$comments_template}", $comments_template]) ?: $comments_template);
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render WordPress searchform using Blade
|
||||||
|
*/
|
||||||
|
add_filter('get_search_form', function () {
|
||||||
|
return template('partials.searchform');
|
||||||
|
});
|
||||||
|
|||||||
7
resources/views/partials/searchform.blade.php
Normal file
7
resources/views/partials/searchform.blade.php
Normal 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 …', 'placeholder' ) !!}" value="{{ get_search_query() }}" name="s" />
|
||||||
|
</label>
|
||||||
|
<input type="submit" class="search-submit" value="{{ esc_attr_x( 'Search', 'submit button' ) }}" />
|
||||||
|
</form>
|
||||||
Reference in New Issue
Block a user