-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_search_form heredoc.php
More file actions
34 lines (27 loc) · 951 Bytes
/
get_search_form heredoc.php
File metadata and controls
34 lines (27 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
function philosophy_search_form( $form ) {
$homedir = home_url( "/" );
$label = __( "Search for:", "philosophy" );
$button_label = __( "Search", "philosophy" );
$post_type = <<<PT
<input type="hidden" name="post_type" value="post">
PT;
if ( is_post_type_archive( 'book' ) ) { // book is a post type
$post_type = <<<PT
<input type="hidden" name="post_type" value="book">
PT;
}
$newform = <<<FORM
<form role="search" method="get" class="header__search-form" action="{$homedir}">
<label>
<span class="hide-content">{$label}</span>
<input type="search" class="search-field" placeholder="Type Keywords" value="" name="s"
title="{$label}" autocomplete="off">
</label>
{$post_type}
<input type="submit" class="search-submit" value="{$button_label}">
</form>
FORM;
return $newform;
}
add_filter( "get_search_form", "philosophy_search_form" );