Last active
August 29, 2015 14:10
-
-
Save joshuadavidnelson/545c2eedb4d533064f5c to your computer and use it in GitHub Desktop.
Search for limited to a caetgory
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 | |
// Search form, limited to category | |
echo '<form method="get" action=" ' . home_url() . '/">'; | |
echo '<input type="text" size="16" name="s" placeholder="Search" />'; | |
// This will limit the search to the year shown on the template, if the year query var is present | |
if( $year = get_query_var( 'yr' ) ) { | |
echo '<input type="hidden" name="year" id="year" value="' . $year . '" />'; | |
} | |
echo '<input type="hidden" name="cat" id="cat" value="19" />'; // replace value with category id | |
echo '<input type="submit" value="Go" />'; | |
echo '</form>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment