1

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

2

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
3
  • 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. Jan 9 '13 at 11:00
  • Please expand your answer with some examples, not just links
    – shea
    Jan 9 '13 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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