Home tips How to add a Search box in WordPress template
Saturday, 20 March 2010 18:03

How to add a Search box in WordPress template?

This is very simple article. This code will be helpful for theme developers and for those who like to add search to their WordPress blog template.

 

1. Open Your Wordpress installed folder and find file searchform.php. You can find it here: wp-content/themes/YourThemeName/. If searchform.php file exist, skip step 2 and go to step 3.

 

2. If You can't find searchform.php create new with this code:

 


<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
<div class="searchBox"><input class="serchText" type="text" value="Search" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" class="serchBtn" />
</div>
</form>

 

3. Now add this code to your template:

 


<?php include (TEMPLATEPATH . '/searchform.php'); ?>

 

Thats it. Now You know how to add search bar in WP blog.


Last Updated on Saturday, 20 March 2010 18:11
 

Comments 

 
#1 2010-12-05 06:39
Thanks bro this helped me out!
Quote
 

Add comment


Security code
Refresh

© 2010. Sopov.com