-
-
Save jazzsequence/e7166cadba43a97a18ac to your computer and use it in GitHub Desktop.
nps search form
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
<?php | |
function nps_get_taxonomy_search_form( $term = null, $taxonomy = null ) { | |
if ( !$term ) { | |
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); | |
$term = $term->name; | |
} | |
if ( !$taxonomy ) | |
$taxonomy = get_query_var( 'taxonomy' ); | |
$form =' | |
<form role="search" method="get" class="search-form" action="' . get_home_url( '/' ) . '"> | |
<label> | |
<input type="search" class="search-field" placeholder="Search" value="" name="s" title="Search for:" /> | |
</label> | |
<input type="hidden" name="' . $taxonomy . '" value="' . $term . '" /> | |
</form> | |
'; | |
echo $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment