Skip to content

Instantly share code, notes, and snippets.

@skorasaurus
Last active October 28, 2019 15:26
Show Gist options
  • Save skorasaurus/13397a18334f1ffd3723614443d9ba11 to your computer and use it in GitHub Desktop.
Save skorasaurus/13397a18334f1ffd3723614443d9ba11 to your computer and use it in GitHub Desktop.
$search_unique_id = esc_attr( wp_unique_id() );
?>
<form role="search" method="get" class="search-form"
action="<?php echo esc_url( home_url( '/' ) ); ?>">
<label for="search-input-<?php echo ( $search_unique_id ); ?>" class="label-large"> Enter what you want to search for</label>
<input type="search" id="search-input-<?php echo ( $search_unique_id ); ?>" required class="search-field" placeholder="<?php echo '" name="s"'; ?> />
================================
example output:
<form role="search" method="get" class="search-form" action="https://local.wordpress.test/">
<label for="search-input-1" class="label-large"> Enter what you want to search for</label>
<input type="search" id="search-input-1" required="" class="search-field js-first-focus" placeholder="" name="s">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment