searchform.php

Description: The default search form. Displayed by default in the sidebar and on the Archives Index page, if one is created. Also displayed by archive.php and index.php if The Loop does not find any posts to display.

This template is included by:

Template Code

<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
	<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
		<input type="submit" id="searchsubmit" value="Search" />
	</div>
</form>

This template includes the following tags:

  • bloginfo() is a WordPress function that displays information about your blog. Using various parameters, the function can display the following strings:
    • Blog title;
    • Blog tagline;
    • Administrator's email address;
    • Document content-type;
    • Document charset;
    • WordPress version;
    • Blog URL;
    • Pingback URL;
    • URL of the RSS 0.92, RSS 1.0, RSS 2.0, or Atom feed;
    • URL of the comments feed;
    • URL of the directory in which WordPress is installed;
    • URL of the current template's directory;
    • URL of the current style.css file;
    • URL of the stylesheet directory (deprecated)
  • the_search_query() is a WordPress tag which displays the search query for the current request, if a search has been made.

HTML Skeleton

<form id="searchform">
	<div>
		<input id="s" />
		<input id="searchsubmit" />
	</div>
</form>

Related CSS Styles

/* Begin Typography & Colors */

body {
	font-size: 62.5%; /* Resets 1em to 10px */
	font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
	background: #d5d6d7 url('images/kubrickbgcolor.jpg');
	color: #333;
	text-align: center;
}

#page {
	background-color: white;
	border: 1px solid #959596;
	text-align: left;
}

#sidebar {
	font: 1em 'Lucida Grande', Verdana, Arial, Sans-Serif;
}

/* Begin Structure */

body {
	margin: 0 0 20px 0;
	padding: 0;
}

#page {
	background-color: white;
	margin: 20px auto;
	padding: 0;
	width: 760px;
	border: 1px solid #959596;
}

/* Begin Lists */

#sidebar ul, #sidebar ul ol {
	margin: 0;
	padding: 0;
}

#sidebar ul li {
	list-style-type: none;
	list-style-image: none;
	margin-bottom: 15px;
}

/* Begin Form Elements */

#searchform {
	margin: 10px auto;
	padding: 5px 3px;
	text-align: center;
}

#sidebar #searchform #s {
	width: 108px;
	padding: 2px;
}

#sidebar #searchsubmit {
	padding: 1px;
}

/* Begin Sidebar */

#sidebar
{
	padding: 20px 0 10px 0;
	margin-left: 545px;
	width: 190px;
}

#sidebar form {
	margin: 0;
}

Resources

  • N/A