How to add search box?
-
what is the easiest way to add a search box to my sidebar?
-
Is the theme you are using widget-compatible?
no, dont think so
just need the snippet of code for the search box, i think there is something like that, no?
This is the code from my themes sidebar search:
<!-- // <label for="s"><?php _e('Search:'); ?></label> --> <br />
<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div>
<input type="text" name="s" id="s" size="15" /> <input type="submit" value="<?php _e('search'); ?>" />
</div>
</form><?php /* If this is a category archive */ if (is_category()) { ?>
<p class="cmeta">You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p><?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
<p class="cmeta">You are currently browsing the weblog archives
for the day <?php the_time('l, F jS, Y'); ?>.</p><?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<p class="cmeta">You are currently browsing the weblog archives
for <?php the_time('F, Y'); ?>.</p><?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<p class="cmeta">You are currently browsing the weblog archives
for the year <?php the_time('Y'); ?>.</p><?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
<p class="cmeta">You have searched the weblog archives
for <strong>'<?php echo wp_specialchars($s); ?>'</strong>.</p><?php /* If this is a monthly archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<p class="cmeta">You are currently browsing the weblog archives.</p><?php } ?>
My theme uses simply this in the sidebar:
<li>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
</li>This can be used with the Default theme which comes with searchform.php built-in. I don’t know if your theme has it. I can give you the contents of searchform.php if you need that too.
The topic ‘How to add search box?’ is closed to new replies.