Skip to content

Instantly share code, notes, and snippets.

@mattkelley
Last active December 28, 2015 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattkelley/7539945 to your computer and use it in GitHub Desktop.
Save mattkelley/7539945 to your computer and use it in GitHub Desktop.
A lean, and simple WordPress search form.
<?php
// Set placeholder value
$placeholder = is_search() ? esc_attr(get_search_query()) : esc_attr_e('Search', 'firewood'); ?>
<form method="get" action="<?php echo trailingslashit(home_url()); ?>">
<input type="search" name="search" placeholder="<?php echo $placeholder; ?>" />
<input type="submit" name="submit" value="<?php esc_attr_e('Search', 'firewood'); ?>" />
</form><!-- / form -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment