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.
You may like to read this also....
Post comment
Search in this website
our sponsors
latest comments
- venkat on C programming interview questions and answers for freshers
- Ankur on How to configure mail from localhost ( wamp ) using PHP?
- ergVFyd on Huffman Encoding Using Linked List with Source Code
- karthick on how can I write applications in C or C++ for Android?
- karthick on how can I write applications in C or C++ for Android?
Find us on Facebook
Top Authors
Find us on stackoverflow
Polls
My Bookmarks
- Audio/video Recorder & player application based on MATLAB
- check dependency of your binary
- defination of all standard c programming language function
- Great Question-Answer on c programming
- know what your c code means
- Limition of c programming language
- List of all version of c programming language
- Online c compiler
- php freelancing work
- some more stuff on C programming language
- Volatile Keyword in Embedded System
- Write Android application in c language