Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a way to display a search box on a page (resembling the google landing page)?

I have tried to create a search page template. However, this doesn't work as all the wp-template styling disappears.

Thanks

share|improve this question

1 Answer 1

You can do this using the get_search_form() function. For your custom parameters you can add some hidden fields or you can modify the action attribute value.

The following can be considered as your form layout.

<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
    <div><label class="screen-reader-text" for="s">Search for:</label>
        <input type="text" value="" name="s" id="s" />
        <input type="submit" id="searchsubmit" value="Search" />
    </div>
</form>

You can add your own parameters such as tags, etc. by appending the get parameters to the action attribute of form.

Refer some examples below:

  1. WordPress Codex
  2. WP Beginner
share|improve this answer
    
Thanks. I must have been unclear in my message. I do not want a google search. I want the wp search so i can moderate it a little (excluding certain tags etc.). I just want it to resemble the google landing page in the sense that i want a regular page with a search form on it. –  Michael Jan 9 '13 at 10:42
    
I have modified the answer as per your requirement. Check now. –  Rohit Pande Jan 9 '13 at 11:00
    
Please expand your answer with some examples, not just links –  bungeshea_ Jan 9 '13 at 12:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.