updates searchform with bs5 template

This commit is contained in:
Brian Coords 2021-09-11 14:37:25 -07:00
parent 1576ca2617
commit 8b7c18de14
1 changed files with 8 additions and 3 deletions

View File

@ -8,7 +8,8 @@
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
$uid = wp_unique_id( 's-' ); // The search form specific unique ID for the input.
$bootstrap_version = get_theme_mod( 'understrap_bootstrap_version', 'bootstrap4' );
$uid = wp_unique_id( 's-' ); // The search form specific unique ID for the input.
$aria_label = '';
if ( isset( $args['aria_label'] ) && ! empty( $args['aria_label'] ) ) {
@ -20,9 +21,13 @@ if ( isset( $args['aria_label'] ) && ! empty( $args['aria_label'] ) ) {
<label class="sr-only" for="<?php echo $uid; ?>"><?php echo esc_html_x( 'Search for:', 'label', 'understrap' ); ?></label>
<div class="input-group">
<input type="search" class="field search-field form-control" id="<?php echo $uid; ?>" name="s" value="<?php the_search_query(); ?>" placeholder="<?php echo esc_attr_x( 'Search &hellip;', 'placeholder', 'understrap' ); ?>">
<span class="input-group-append">
<?php if ( 'bootstrap5' === $bootstrap_version ) : ?>
<input type="submit" class="submit search-submit btn btn-primary" name="submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'understrap' ); ?>">
</span>
<?php else : ?>
<span class="input-group-append">
<input type="submit" class="submit search-submit btn btn-primary" name="submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'understrap' ); ?>">
</span>
<?php endif; ?>
</div>
</form>
<?php