Last active
August 29, 2015 14:23
-
-
Save curiouscrusher/7acabe877706303fe3c1 to your computer and use it in GitHub Desktop.
A search box to show results only from a specified category in Wordpress
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 $category_id = get_cat_ID('Your Category'); ?> | |
<form id="yourformid" method="get" action="<?php bloginfo('url'); ?>"> | |
<input type="text" name="s" id="s" size="20" placeholder="Search" /> | |
<input type="hidden" name="cat" value="<?php echo $category_id; ?>" /> | |
<input type="submit" value="Search" /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment