Creating a custom search form in WordPress

Any form can submit a query to WordPress. The things to keep in mind are:

  • Submitting the request to your blog URL ( bloginfo(‘url’) )
  • The name of the variable that will hold the value of the search term should s unless your blog is setup differently
  • You can write the code of your search form in a separate PHP file and include it in many pages using include (TEMPLATEPATH . "/my_search_form.php");
<form method="get" id="searchform-txt" action="<?php bloginfo('url'); ?>/">
		<input type="text" value="<?php the_search_query(); ?>" name="s" id="s-txt" />
		<input type="submit" id="searchsubmit-txt" value="" />
		<div class="clear"></div>		

Read more:

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

IMPORTANT! To be able to proceed, you need to solve the following simple math (so I know that you are a human) :-)

What is 12 + 13 ?
Please leave these two fields as-is: