Search form for wordpress boostrap based theme

As I create a boostrap based theme for bootstrap despite why-bootstrap-is-a-bad-fit-for-wordpress-themes, I wanted to have a search form that fits well. creating-bootstrap-wordpress-theme-search, and enhanced for Boostrap 3.2, here is my searchform.php

<?php $search_terms = htmlspecialchars( $_GET["s"] ); ?>

<form role="form" action="<?php bloginfo('siteurl'); ?>/"
  id="searchform" method="get">
  <label for="s" class="sr-only">Search</label>
  <div class="input-group">
    <input type="text" class="form-control" id="s" name="s"
      placeholder="Search"
      <?php if ( $search_terms !== '' ) { echo ' value="' . $search_terms . '"'; } ?> />
    <span class="input-group-btn">
      <button type="submit" class="btn btn-primary">
        <i class="glyphicon glyphicon-search"></i>
      </button>
    </span>
  </div>
  <!-- .input-group -->
</form>

Popular posts from this blog

Soving AccessDenied on Google Cloud Storage domain mapping

Fixing "DerInputStream.getLength(): lengthTag=109, too big" in Android Studio

USB Foot Switch II - "Usb HIDKB Not connected"