Feb
10

Insert your own Search option in your wordpress theme

 While developing you own theme many times you don’t want to use the default search of the wordpress and you want your own search option which looks better and suits your site design.So if you want to insert your own search option in the theme instead of the default search its very easy to implement it.

Now lets do that in the wordpress theme,

First of all add one function in the functions.php file in your theme folder.

This function creates your search view.And add it to the wordpress site where ever you want.

So lets define that function in functions.php file,

function custom_search_form() {
?>
<form method="get" class="" action="<?php bloginfo('home'); ?>/">
<p>
 
<input type="text" value="" name="s" id="s"  />
<input type="submit" value="Go" />
</p>
</form>
<?php }
 
add_action('thesis_hook_header' , 'custom_search_form');
?>


You can also use echo for the form display if you want.

Now you have to call this function in the page where you want to insert the search option.Basically you wish to add it to the header so that it can be seen throwout the site.But if you want to display it in some particular page just call the function you have just defined in the desired page.You can do this by putting below code,

            
 <div class="search">
        <?php custom_search_form(); ?>
 </div>

Add your own class here instead of the search class of mine for your custom  search option in the site. And insert css for that class in the style.css file of your theme folder.

Above code will result in the site as,

Its done with the code.Now enjoy your searching.

 

Arpi

hiii friends… i am doing msc in computer application and information technology. we are here to share our knowledge and idea on shareprogrammingtips.com.

More PostsWebsite

You may like to read this also....

Post comment

*

CommentLuv badge
Follow us on Twitter! Follow us on Twitter!

Search in this website

our sponsors

latest comments

Find us on Facebook

Top Authors

35 posts
saurabh
22 posts
10 posts

Find us on stackoverflow

Polls

Tell us who you are

View Results

Loading ... Loading ...

My Bookmarks

Sponsers Link