How can I add custom search box on page?

I’m using custom WordPress template and I don’t know how to add search box in a specific place. Of course my template contains search box, but it is in a weird place, so I would like to add custom one. I cannot do that by adding widget. I have to edit index.php to add search box.

When I add this:

Read More
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
<div><input type="text" size="18" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" class="btn" />
</div>
</form>

Basically, it is working. It is searching properly, but the search box is bad looking.

That one works as well:

<form method="get" id="search_form" action="<?php bloginfo('home'); ?>"/>
       <input type="text" class="text" name="s" value="SEARCH" >
       <input type="submit" class="submit" value=""  />
</form>

But again, it looks awfull. I have to have custom css too.

And another one:

<?php get_search_form(); ?>

Works good, but the same problem. It is just like in 2000.

I tried adding custom css, but the problem is that id does not not searching anything on my website. Instead going to http://example.com/?s=WHAT-I-TYPED it goes to http://example.com/

What can I do with that?

Related posts

Leave a Reply

1 comment