Line | |
---|
1 | <?php // create new search widget
|
---|
2 | function widget_search($args) {
|
---|
3 | extract($args);
|
---|
4 | $searchform_template = get_template_directory() . '/searchform.php';
|
---|
5 |
|
---|
6 | echo $before_widget;
|
---|
7 |
|
---|
8 | // Use current theme search form if it exists
|
---|
9 | if ( file_exists($searchform_template) ) {
|
---|
10 | include_once($searchform_template);
|
---|
11 | } else { ?>
|
---|
12 | <form id="searchform" method="get" action="<?php bloginfo('url'); ?>/"><div>
|
---|
13 | <label class="hidden" for="s"><?php _e('Search for:','atahualpa'); ?></label>
|
---|
14 | <input type="text" name="s" id="s" size="15" value="<?php the_search_query(); ?>" />
|
---|
15 | <input type="submit" value="<?php echo attribute_escape(__('Search','atahualpa')); ?>" />
|
---|
16 | </div></form>
|
---|
17 | <?php }
|
---|
18 | echo "</div>";
|
---|
19 | }
|
---|
20 | ?>
|
---|
21 | <?php // unregister old / register new search widget
|
---|
22 | $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your blog","atahualpa") );
|
---|
23 | unregister_sidebar_widget('search', __('Search','atahualpa'), 'wp_widget_search', $widget_ops);
|
---|
24 | wp_register_sidebar_widget('search', __('Search','atahualpa'), 'widget_search', $widget_ops);
|
---|
25 | ?> |
---|
Note:
See
TracBrowser
for help on using the repository browser.