Search feature for Dan Seals for Congress
Wordpress comes prepackaged with a pretty decent search function. You can call the search fields with this string:

<?php include (TEMPLATEPATH . '/searchform.php'); ?>

That’s going to fetch the contents of searchform.php, which should look like this:

<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">    <label class="hidden" for="s"><?php _e(''); ?></label>    <input class="swap_value searchform" type="text" value="Search..." name="s" id="s" />    <input class="searchbutton" type="submit" id="searchsubmit" value="" /></form>

In this instance, I added the “searchform” and “searchbutton” classes so I could target the form with CSS, and I dropped in the “swap_value” class to trigger Cory Schires’ jQuery Swap Form Value plugin (clears the form when the user clicks into it).
The search results are dropped into the search.php template, which builds just like single.php or page.php (header, if (have_posts()), sidebar, footer). There are a lot of plugins available that spiff up the search algorithm, but I generally find Wordpress’ search to be pretty effective. Most importantly, it rolls out fast!

Search feature for Dan Seals for Congress

Wordpress comes prepackaged with a pretty decent search function. You can call the search fields with this string:

<?php include (TEMPLATEPATH . '/searchform.php'); ?>

That’s going to fetch the contents of searchform.php, which should look like this:

<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
    <label class="hidden" for="s"><?php _e(''); ?></label>
    <input class="swap_value searchform" type="text" value="Search..." name="s" id="s" />
    <input class="searchbutton" type="submit" id="searchsubmit" value="" />
</form>

In this instance, I added the “searchform” and “searchbutton” classes so I could target the form with CSS, and I dropped in the “swap_value” class to trigger Cory Schires’ jQuery Swap Form Value plugin (clears the form when the user clicks into it).

The search results are dropped into the search.php template, which builds just like single.php or page.php (header, if (have_posts()), sidebar, footer). There are a lot of plugins available that spiff up the search algorithm, but I generally find Wordpress’ search to be pretty effective. Most importantly, it rolls out fast!

1 year ago   |  5 notes
  1. paulstraw said: Nice! Using the placeholder attribute + a tiny snippet of jQuery (which I could send your way if you wanted) gives you a simple, cross-browser, semantic input replacement that uses the built-in browser placeholder functionality if it’s there.
  2. maxistentialist posted this