Search in single category
-
I want to add a search button (in addition to the one already there) that searches through a certain category only. I copied the searchform code:
<div id="search-bar"> <form method="get" id="searchform" action="<?php bloginfo('url'); ?>"> <input type="text" value="<?php _e('search all tutorials...','AskIt'); ?>" name="s" id="searchinput" /> <input type="image" src="<?php bloginfo('template_directory'); ?>/images/search-icon.png" id="searchsubmit" /> </form> </div>And added this code:
<input type=”hidden” name=”cat” id=”cat” value=”4403″/>
<div id="search-bar"> <form method="get" id="searchform" action="<?php bloginfo('url'); ?>"> <input type="hidden" name="cat" id="cat" value="4403"/> <input type="text" value="<?php _e('search all tutorials...','AskIt'); ?>" name="s" id="searchinput" /> <input type="image" src="<?php bloginfo('template_directory'); ?>/images/search-icon.png" id="searchsubmit" /> </form> </div>If you go on: http://ahhelp.me/tutorials/, you can see the search bar there… but when you click in the there, the text “search all tutorials” doesn’t go away, and once you search something and press the back button, that search term appears in the top search bar instead. I’m guessing it’s because the ID’s are the same in both search bars? Maybe I have to create a separate searchform.php file and reference that somehow? Any ideas? Really need help!
The topic ‘Search in single category’ is closed to new replies.