-
-
Save jchristopher/c26dcb5e7e06eff66749e970c4bb843b to your computer and use it in GitHub Desktop.
Adds checkbox to limit to Title search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>"> | |
<label> | |
<span class="screen-reader-text"><?php echo _x( 'Search for:', 'label' ) ?></span> | |
<p> | |
<input type="checkbox" name="searchwp_limit_to_title" id="searchwp_limit_to_title" value="1" <?php if ( ! empty( $_REQUEST['searchwp_limit_to_title'] ) ) : ?>checked="checked"<?php endif; ?> /> | |
<label for="searchwp_limit_to_title"><?php esc_html_e( 'Limit to Titles', 'searchwp_child_theme' ); ?></label> | |
</p> | |
<input type="search" class="search-field" | |
placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder' ) ?>" | |
value="<?php echo get_search_query() ?>" name="s" | |
title="<?php echo esc_attr_x( 'Search for:', 'label' ) ?>" /> | |
</label> | |
<input type="submit" class="search-submit" | |
value="<?php echo esc_attr_x( 'Search', 'submit button' ) ?>" /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment