forked from Automattic/_s
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearchform.php
More file actions
17 lines (16 loc) · 856 Bytes
/
searchform.php
File metadata and controls
17 lines (16 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
if ( 'page' === get_option( 'show_on_front' ) && ( is_home() || is_single() || is_archive() ) ) {
$action = get_permalink( get_option( 'page_for_posts' ) );
} elseif ( is_post_type_archive() || ( is_singular() && get_post_type_archive_link( get_post_type() ) ) ) {
$action = get_post_type_archive_link( get_post_type() );
} else {
$action = get_home_url( '/' );
}
?>
<form role="search" method="get" class="search-form" action="<?php echo esc_url( $action ); ?>">
<label>
<span class="screen-reader-text"><?php _x( 'Search for:', 'label' ); ?></span>
<input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder' ); ?>" value="<?php get_search_query(); ?>" name="s" />
</label>
<button type="submit" class="search-submit" ><?php esc_html_e( 'Search', 'submit button' ); ?></button>
</form>